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

name several ways to achieve efficiency in your program? : Sas programming

566


what does the run statement do? : Sas programming

550


how does sas handle missing values in a merge? : Sas programming

547


What is a method to debug and test your SAS program?

706


What do the mod and int function do? : Sas programming

565






What’s the difference between var b1 – b3 and var b1 — b3?

814


What is the difference between nodupkey and nodup options?

588


What is the different between functions and PROCs that calculate the same simple descriptive statistics?

1219


What is the differnce between SDTM 3.1.2 to 3.1.1 version

4596


Describe the ways in which you can create macro variables?

623


how could you generate test data with no input data? : Sas programming

615


explain what is factor analysis? : Sas-administrator

593


How do you define proc in sas? : sas-grid-administration

663


what are _numeric_ and _character_ and what do they do? : Sas programming

668


Which command is used to perform sorting in sas program?

591