BookmarkSubscribeRSS Feed
Zatere
Quartz | Level 8

Hi,

 

I am looking for an alternative method to get the results you get when using PROC COMPARE. I ve got a dataset which has columns representing values from two different years. For example, Total_Value_Y1 and Total_Value_Y2, Total_Quantity_Y1 and Total_Quantity_Y2 and so on. 

 

I want to get the difference of the pairs of the numeric columns and indication when the columns are character.

 

Below a sample code for illustration:

 

data class2;
set sashelp.class;

if age=12 then weight1=50; else weight1 = weight;
if age=12 then sex1='K'; else sex1 = sex;
if age=12 then height1=60; else height1 = height;
run;

proc compare data=class2 out=check  ;
by name;
var weight height sex;
with weight1 height1 sex1;
run;

When the dataset is large it takes a long time to run. Is there a more efficient way to get the same rerults?

 

Thanks!

1 REPLY 1
SASKiwi
PROC Star

I use PROC COMPARE a lot and find it reasonably efficient for comparing large datasets. It does get slower the more differences there are, but that would be the same regardless of what method you use. Put it this way in my experience it is not a lot slower than creating the datasets being compared in the first place.

 

As an alternative I would suggest trying PROC SQL. If there are a lot of differences in your data then it could be more efficient. 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1 reply
  • 958 views
  • 0 likes
  • 2 in conversation