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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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