BookmarkSubscribeRSS Feed
anandbillava
Fluorite | Level 6
Hi
Is there any comparision record identifier which can be seen in the output result set of proc compare
Basically comapre output will be like this

base
compare
dif
base
compare
dif
I want to have a record identifier for this comparision that will uniquely tell this is the nth comparision.
comparision number
base 1
compare 1
dif 1
base 2
compare 2
dif 2
base 3
base 4
compare 4
dif 4

Is this possible please let me know.
4 REPLIES 4
ArtC
Rhodochrosite | Level 12
Be sure to include the BY and/or the ID statements. These values will also be added to your output observations.

[pre]data diffclass;
set sashelp.class;
if _n_= 1 then age=age+1;
if _n_= 2 then delete;
if _n_= 3 then weight = weight*2;
run;

proc compare data=sashelp.class
compare=diffclass
out=cmprdat
outbase outcomp
noprint outnoequal;
id name;
run;
proc print data=cmprdat;
run;[/pre]
anandbillava
Fluorite | Level 6
No this gives the observation number of base and compare dataset.
This is not the comparision record number.
ArtC
Rhodochrosite | Level 12
I am sorry, but I do not understand what you are asking for. What is the comparison record number?
sivaji
Fluorite | Level 6
Question is not clear! could you elaborate on the same. thanks

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1619 views
  • 0 likes
  • 3 in conversation