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
I have 3 years of work experience at a startup and recently got certified in Data Science with SAS. I need to know how to get into the analytics industry
How we can create SAS USER DEFINED CODE?
What would be the value of month at the end of data step execution and how many observations would be there?
What are the features of base sas system?
how to do user inputs and command line arguments in sas?
What are the different versions of sas that you have used until now? : sas-grid-administration
what do the sas log messages "numeric values have been converted to character" mean? : Sas programming
what are the best practices to process the large data sets in sas programming? : Sas-administrator
how many types of prompts are there? : Sas-bi
Explain what is the use of proc gplot?
what is sas metadata repository? : Sas-bi
Name and describe few sas character functions that are used for data cleaning in brief.
Explain the special input delimiters used in sas programming.
List out some key concept of SAS
why a stop statement is needed for the point= option on a set statement?