We have two SAS data set:
We need the output like:
One | ||
Code | Name | Age |
A00 | Ram | 21 |
A11 | Sita | 23 |
A22 | Radha | 24 |
A33 | Arjun | 23 |
Two | ||
Code | Name | Age |
111 | Laksman | 20 |
222 | Krishna | 25 |
333 | Bhim | 26 |
We need the output like:
Three | ||||||||
Code | Name | Age | ||||||
A00 | Ram | 21 | ||||||
111 | Laksman | 20 | ||||||
A11 | Sita | 23 | ||||||
222 | Krishna | 25 | ||||||
A22 | Radha | 24 | ||||||
333 | Bhim | 26 | ||||||
A33 | Arjun | 23 | ||||||
Now prepare your Base SAS and
Advance SAS Certification Exams with Online Mock tests: http://exam.sankhyana.com
For training related info kindly mail us at info@sankhyana.com www.sankhyana.com |
data one;
ReplyDeleteinput Code$ Name $ Age;
cards;
A00 Ram 21
A11 Sita 23
A22 Radha 24
A33 Arjun 23
;
run;
data two;
input Code$ Name $ Age;
cards;
111 Laksman 20
222 Krishna 25
333 Bhim 26
444 Vishm 27
;
run;
data one;
set one;
A+1;
run;
data two;
set two;
A+1;
run;
data three;
set one two;
by A;
drop A;
run;
After creating two data sets.....data sets are already in sorted order
ReplyDeleteSo....
Data m;
Merge demo1 demo2;
By code;
If substr(code,2,2)='00' then p='a';
Else if(code,2,2)='11' then p='b';
Else if(code,2,2)='22' then p='c';
Else
P='d';
Run;
Proc sort data=m out=l(drop=p);
By p;
Run;