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
Which command is used to perform sorting in sas program?
what is change analysis in sas di ? : Sas-di
how many display types available in sas bi dashboard? : Sas-bi
Name types of category in which SAS Informats are placed?
it will become easy if uuu provide website linkssss and list of consultanciessssss
what is study design in while working with SAS? what are screening variables in SAS?
what is the primary data source for the wrs? : Sas-bi
Are you involved in writing the inferential analysis plan? Tables specifications?
why is sas considered self-documenting? : Sas programming
what is proc Index? and what is proc document?
Have you used macros? For what purpose you have used? : sas-macro
what can you learn from the sas log when debugging? : Sas programming
How to test the debugging in sas?
To what type of programms have you used scratch macros?
How to limit decimal places for variable using proc means?