DATA Step, Macro, Functions and more

Proc compare Any record identifier

Reply
Contributor
Posts: 72

Proc compare Any record identifier

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.
Valued Guide
Posts: 632

Re: Proc compare Any record identifier

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]
Contributor
Posts: 72

Re: Proc compare Any record identifier

No this gives the observation number of base and compare dataset.
This is not the comparision record number.
Valued Guide
Posts: 632

Re: Proc compare Any record identifier

I am sorry, but I do not understand what you are asking for. What is the comparison record number?
Occasional Contributor
Posts: 17

Re: Proc compare Any record identifier

Question is not clear! could you elaborate on the same. thanks
Ask a Question
Discussion stats
  • 4 replies
  • 167 views
  • 0 likes
  • 3 in conversation