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
what is broad cast agent? : Sas-bi
Explain what is the use of proc gplot?
how can you put a "trace" in your program? : Sas programming
What are the data types in sas?
What is run-group processing?
what do the pad and dim functions do? : Sas programming
Is the physical structure of the data set in the same orientation as the report? Do you need to reshape the data sets? What method should you use to reshape the data–DATA steps,PROC TRANSPOSE,output data set from a procedure?
what is SAS OPTIMIZATION?
what is information maps?
What will calendar procedure do?
which date functions advances a date time or date/time value by a given interval? : Sas programming
What are types of transport files?
How does SAS handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, PROCs?
What are the different versions of sas that you have used until now? : sas-grid-administration
what is enterprise guide? What is the use of it? : Sas programming