data WBC;
input subject $ TRTA $ Amethod $ WBC;
datalines;
1 A Upper 2.2
1 A lower 2.1
;
data QS;
input subject $ TRTA $ QS $ QSVAL;
datalines;
1 A Q1 99
1 A Q2 100
;
proc sort data=wbc; by subject trta; run;
proc sort data=qs; by subject trta; run;
data all;
merge wbc qs;
by subject trta ;
RUN;
here is the data that I get
SUBJECT | TRTA | AMETHOD | WBC | QS | QSVAL |
1 | A | Upper | 2.2 | Q1 | 99 |
1 | A | lower | 2.1 | Q2 | 100 |
this is what I want
SUBJECT | TRTA | AMETHOD | WBC | QS | QSVAL |
1 | A | Upper | 2.2 | Q1 | 99 |
1 | A | Upper | 2.2 | Q2 | 100 |
1 | A | lower | 2.1 | Q1 | 99 |
1 | A | lower | 2.1 | Q2 | 100 |
created this and it is not working for me.
@mona4u wrote:
created this and it is not working for me.
I don't know what to say. You have provided no information from which I can help you.
I have multiple treatments and multiple subjects. when I tried that type of merge it is creating some weird results.
I added the where statement and it worked.
Thanks
A MERGE statement cannot UPDATE/DELETE the same row of the target table multiple times. Refine the ON clause to ensure a target row matches at most one source row, or use the GROUP BY clause to group the source rows.
Regards,
Will
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.