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 / sas@freek
data family;
input parent $ child $;
datalines;
A B
B C
C D
D E
E F
F G
G H
H I
;
run;
data family_new(drop=parent child);
set family;
parent1=lag(parent);
child1=lag(child);
grand_child=child;
if _n_ ge 2;
run;
proc print data=family_new;
var parent1 grand_child;
run;
Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
How sas treats the dsd delimiters?
what is the use of sas management console? : Sas-di
What sas features do you use to check errors and data validation?
hi all, I need the SAS DI DUMP(A00 260) for attending the certification. if any one have, pls provide it.Please Email to vrpotluri@hotmail.com. Thanks - Ramana
What is the difference between %put and symbolgen? : sas-macro
what is metadata? : Sas-bi
If a variable contains only numbers, can it be a character data type?
State the difference between INFORMAT and FORMAT ?
What is the use of %include statement?
Explain the use of proc gplot? : sas-grid-administration
How we can create SAS USER DEFINED CODE?
What are the difficulties u faced while doing vital signs table or dataset?
How will you generate test data with no input data?
Did you used proc test? when?
What are the data types that sas contain?