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 / guest

data dx;
infile datalines dsd dlm=',';
input parent :$8. child :$8.;
datalines;
A,B
B,C
D,E
F,G
G,H
H,I
;;;;
run;

data dy(rename=(parent=grandfather child=father)) ;
merge dx(firstobs=2 in =a rename=(child=grandchild
parent=child ))
dx(firstobs=1 in =b );
by child;
if a and b;
run;
proc print;
var grandfather father grandchild;
run;

Is This Answer Correct ?    15 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Give an example where SAS fails to convert character value to numeric value automatically?

1094


How might you use MOD and INT on numeric to mimic SUBSTR on character Strings?

1377


How can I remove header from output data set?

2632


What is the command used to find missing values?

1107


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

1017


what are input dataset and output dataset options? : Sas programming

1111


what are some differences between proc summary and proc means? : Sas programming

1137


name some data transformation used in sas di? : Sas-di

973


How to sort in descending order?

1263


How to convert a numeric variable to a character variable?

1213


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

1112


How are numeric and character missing values represented internally?

1665


What is the difference between %local and %global? : sas-macro

1193


What is the purpose of trailing @ and @@? How do you use them?

1042


what is operational data and operational system? : Sas-di

1117