Suppose there is a SAS dataset with following values -
Parent Child
A B
B C
D E
F G
G H
H I
and so on…..
This goes onto 1000s of observations/rows.
Now how do we identify from this dataset Grandparents and
Grandchildrens ?
Answer Posted / altumish
A simple self Join:
data old;
input Parent $ Child $;
cards;
A B
B C
D E
F G
G H
H I
I J
J K
J L
P S
;
Proc sql;
Select Old.parent as grandfather, Old.Child as father,
new.child as grandchild from work.Old as old, work.Old as new
where old.child = new.parent;
quit;
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
List out some key concept of SAS
How we can create SAS USER DEFINED CODE?
Do you need to know if there are any missing values?
describe about metadata object? : Sas-di
Explain substr function?
what is sas application server? : Sas-di
Difference between SAS STATA & SPSS?
How do dates work in SAS data?
i have a dataset with 100 obs i want to generate title from 20th obs onwards with total observations. that should contain 100 obs.dont use firstobs and dnt split the data. use dataset block or proc report? how can we genarate;
How do you test for missing values?
what cause the "error: connect:" and "error in the libname statement" when there weren't any such problems?
how does sas handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, procs? : Sas programming
What do you understand by the term Normal Distribution?
Give some ways by which you can define the variables to produce the summary report (using proc report)?
Explain the use of proc gplot? : sas-grid-administration