BookmarkSubscribeRSS Feed
LineMoon
Lapis Lazuli | Level 10

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
4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

I don't understand what you are talking about. You'll need to give more explanations if you want an answer.

ballardw
Super User

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.

LineMoon
Lapis Lazuli | Level 10

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

 

 

ChrisNZ
Tourmaline | Level 20

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;

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

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
  • 4 replies
  • 836 views
  • 0 likes
  • 3 in conversation