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

Describe the function and untility of the most difficult SAS macro that you have written.

2167


Are you sensitive to code walk-throughs peer review or QC review?

3201


what is sas olap server? : Sas-di

1298


What are the functions used for character handling?

1311


What are the difference between sas functions and procedures?

1203


how to debug and test the sas program? : Sas-administrator

1078


What are the best sas programming practices for handling very large datasets? : sas-grid-administration

1069


hi tell be about pfizer? how to compare the work with other companies ? please tell me how to login and work also?

2111


How can you limit the variables written to output dataset in data step?

1381


What is the difference between INPUT and INFILE ?

1377


In proc transpose and data step with arrays which one you pick?

3178


How will you use the WHO Drug Dictionary for Reporting Clinical Trials?

2395


What is program data vector (pdv)?

1394


How do you delete duplicate observations in sas?

1113


how can you import .csv file in to sas? : Sas programming

1140