Help using Base SAS procedures

Horizontal combining of data: Please help

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 9
Accepted Solution

Horizontal combining of data: Please help

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


Accepted Solutions
Solution
‎07-25-2013 04:50 PM
Super User
Posts: 5,085

Re: Horizontal combining of data: Please help

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


All Replies
Solution
‎07-25-2013 04:50 PM
Super User
Posts: 5,085

Re: Horizontal combining of data: Please help

A few more lines of code would do it:

data combine;

merge a b;

by pt;

output;

var1=' ';

var2=' ';

run;

Good luck.

Occasional Contributor
Posts: 9

Re: Horizontal combining of data: Please help

Thank you! It works.

Occasional Contributor
Posts: 9

Re: Horizontal combining of data: Please help

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

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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