Hi All,
I am not able to get the desired output by combining 2 data sets horizontally. I need the following type of output. I need maximum of rows for any value of variable pt and some values in combine data set should be blank. I am using the following code but it is not giving my any blank values in combine data set.
data combine;
merge a b;
run;
Dataset A | Dataset B | Dataset Combine | ||||||
pt | var1 | pt | var2 | pt | var1 | var2 | ||
1 | a | 1 | rrrr | 1 | a | rrrr | ||
1 | b | 1 | grg | 1 | b | grg | ||
2 | fg | 1 | saed2 | 1 | saed2 | |||
2 | d | 2 | fdf | 2 | fg | fdf | ||
2 | wd | 2 | 45fd | 2 | d | 45fd | ||
3 | s | 3 | 35r | 2 | wd | |||
3 | a | 3 | s | 35r | ||||
3 | ds | 3 | a | |||||
3 | ds |
Thanks
A few more lines of code would do it:
data combine;
merge a b;
by pt;
output;
var1=' ';
var2=' ';
run;
Good luck.
A few more lines of code would do it:
data combine;
merge a b;
by pt;
output;
var1=' ';
var2=' ';
run;
Good luck.
Thank you! It works.
Can you explain how it works, if u have time?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.