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 / sumit
Suppose the above dataset name is work.old.
Data new;
Set work.old (first obs = 2);
Run;
Proc sql;
Select Old.parent as grandfather, Old. Child as father,
new.child as grandchild from work.Old as old, work.new as
new
where old.child = new.parent;
quit;
Is This Answer Correct ? | 17 Yes | 0 No |
Post New Answer View All Answers
What are the features of base sas system?
what is the use of proc contents and proc print in sas? : Sas-administrator
explain the difference between alternate key, business key, foreign key, generated key, primary key, retained key and surrogate key ? : Sas-di
what are the component of range? : Sas-bi
What is factor analysis?
What do the PUT and INPUT functions do?
what is scheduling and how will u implement it. In scheduling 5 jobs r running if there is an error occured at 3rd job and how will u check and waht necessary steps will u take not to repeat the same mistake
What is the basic syntax of a sas program?
How would you code a macro statement to produce information on the sas log? This statement can be coded anywhere? : sas-macro
What are the scrubbing procedures in sas?
what is business intelligence? : Sas-bi
How to limit decimal places for variable using proc means?
What is a method for assigning first.VAR and last.VAR to the BY group variable on unsorted data?
what is intially documentation in sas?
Differentiate between ceil and floor functions.