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?

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 1237 views
  • 0 likes
  • 2 in conversation