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

how does sas handle missing values in sort order? : Sas programming

928


What do you know about symput and symget?

1260


Approximately what date is represented by the SAS date value of 730?

1219


How would you determine the number of missing or nonmissing values in computations?

1076


Mention how to limit decimal places for the variable using proc means?

1125


where to use sas business intelligence? : Sas-bi

1093


How to create list output for cross-tabulations in proc freq?

1115


Mention some common errors that are usually committed in sas programming.

1056


What is the difference between where and if statement?

1118


How we can call macros with in data step? : sas-macro

1129


What does proc print, and proc contents are used for?

1139


what are the benefits of data integration? : Sas-di

1112


What is the basic syntax style in SAS?

1174


What is the role of unrestrictive users? : sas-grid-administration

1013


Explain data_null_?

1065