Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is the difference between order and group variable in proc report?

1362


what is PhaseIII, ODS, TLG, Macro and Proc in SAS

4422


what is ae onset date n what is RDS

2458


what versions of sas have you used (on which platforms)? : Sas programming

1002


why a stop statement is needed for the point= option on a set statement?

997


explain the function of substr in sas? : Sas-administrator

953


What are types of transport files?

7861


How to read an input file in sas?

1091


What is the basic structure of a sas program?

1055


I need level 2 to 5 sas using companies in india

2326


Explain how merging helps to combine data sets.

990


What is the command used to find missing values?

1036


How do dates work in sas?

1071


How do you specify the number of iterations and specific condition within a single do loop?

1047


What is the difference between %put and symbolgen? : sas-macro

1158