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
If a variable contains letters or special characters, can it be numeric data type?
What is the length assigned to the target variable by the scan function?
why is a stop statement needed for the point=option on a set statement? : Sas programming
Explain how merging helps to combine data sets.
What is a put statement?
What do the sas log messages “numeric values have been converted to character” mean? What are the implications?
What are the five ways to do a table lookup in sas? : sas-grid-administration
What is factor analysis?
How would you define the end of a macro? : sas-macro
Describe the ways in which you can create a macro variable?
do you prefer proc report or proc tabulate? Why? : Sas programming
what is transformation in sas data integration? : Sas-di
What is connection profile? : sas-grid-administration
What is the difference between where and if statement?
what is the different between functions and procs that calculate the same simple descriptive statistics? : Sas programming