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: Call for Content

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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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