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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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