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


Please Help Members By Posting Answers For Below Questions

What are the features of base sas system?

615


what is the use of proc contents and proc print in sas? : Sas-administrator

608


explain the difference between alternate key, business key, foreign key, generated key, primary key, retained key and surrogate key ? : Sas-di

548


what are the component of range? : Sas-bi

617


What is factor analysis?

663






What do the PUT and INPUT functions do?

783


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

1919


What is the basic syntax of a sas program?

671


How would you code a macro statement to produce information on the sas log? This statement can be coded anywhere? : sas-macro

586


What are the scrubbing procedures in sas?

576


what is business intelligence? : Sas-bi

584


How to limit decimal places for variable using proc means?

592


What is a method for assigning first.VAR and last.VAR to the BY group variable on unsorted data?

2010


what is intially documentation in sas?

4335


Differentiate between ceil and floor functions.

658