In SAS, you can perform one-to-one reading with the help of multiple SET statements. It combines observations from two or more data sets into a single observation in a new data set.
DATA dat1;INPUT id v1 v2;CARDS;1 10 1002 15 1503 20 200;DATA dat2;INPUT id v3 v4;CARDS;1 1000 100002 1500 150003 2000 200004 800 30000;RUN;DATA dat3;set dat1;set dat2;RUN;
![]() |
SAS : Multiple SET Statements |
The observations are combined based on their relative position in the data set.
The output will turn out to be different if:
ReplyDeleteDATA dat3;
set dat1 dat2;
RUN;
in this case datasets will append
Deleteinthis multiple set statement dat2 override dat1.
ReplyDeleteyes... same thing this will only happen when we set dat1 dat2;
Deletethis website is really very helpful
ReplyDeleteDATA dat3;
ReplyDeleteset dat1;
set dat2;
RUN;
dat3 will be minimum of dat1 and dat2
what if i want maximum number of row in dat1 nd dat2
Use Merge without BY
DeleteDATA dat3;
Merge dat1 dat2;
run;
could you explain bit more??
ReplyDeleteIt will append data set ....i think ..how it can merge data set
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteWhat will output when we used set dat1 dat2
Deletehi ,
Deletethe output will be like,
dat 2 observation, kit will omit the dat1,
when we use
set dat1 dat2;
run;
So, it should be like......
ReplyDeletedata new3;
set new1;
set new2;
/* merge new1 new2; */
run;
proc print data=new3;
run;