Hello Experts,
I want only the compare proc out but with this format
| _TYPE_ | obs | var |
| BASE | 1 | 12 |
| COMPARE | 1 | 14 |
| DIF | 1 | 2 |
I do not want in the output
| _TYPE_ | obs | Z1 |
| BASE | 1 |
15 |
| _TYPE_ | obs | Z2 |
| COMPARE | 1 | 23 |
I don't understand what you are talking about. You'll need to give more explanations if you want an answer.
Proc compare has so many different comparison options that you should start by posting the code you are currently using so have a change of guessing what you may be getting at. Best would be to provide short data steps to create the two data sets.
And did you sort the sets before comparison? That sometimes helps a lot.
Thank your for your answer
As an exemple, we can start by these data sets
Table : One
| idn | var |
| 1 | 3 |
| 2 | 10 |
Table : Two
| idn | var |
| 1 | 8 |
| 3 |
7 |
When, we use this code
proc compare base=one comp=two;
out=res outnoequal outbase outcomp;
id idn;
run;
getting the output
| _TYPE_ | obs | Var |
| base | 1 | 3 |
| compare | 1 | 8 |
| base | 2 | 10 |
| compare | 3 | 7 |
I want this output
| _TYPE_ | obs | Var |
| base | 1 | 3 |
| compare | 1 | 8 |
Like this?
proc compare base=one comp=two
out=res outnoequal outbase outcomp;
id idn;
run;
data WANT;
set RES;
by ID notsorted;
if first.ID and last.ID then delete;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.