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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 816 views
  • 0 likes
  • 3 in conversation