BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
pihu_11
Calcite | Level 5

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 ADataset BDataset Combine
ptvar1ptvar2ptvar1var2
1a1rrrr1arrrr
1b1grg1bgrg
2fg1saed21 saed2
2d2fdf2fgfdf
2wd245fd2d45fd
3s335r2wd
3a3s35r
3ds3 a
3 ds

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

A few more lines of code would do it:

data combine;

merge a b;

by pt;

output;

var1=' ';

var2=' ';

run;

Good luck.

View solution in original post

3 REPLIES 3
Astounding
PROC Star

A few more lines of code would do it:

data combine;

merge a b;

by pt;

output;

var1=' ';

var2=' ';

run;

Good luck.

pihu_11
Calcite | Level 5

Thank you! It works.

pihu_11
Calcite | Level 5

Can you explain how it works, if u have time?

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 929 views
  • 0 likes
  • 2 in conversation