BookmarkSubscribeRSS Feed
Sandeep77
Lapis Lazuli | Level 10

Hi Experts,

I want to compare two huge data set with lot of rows and columns. With proc compare can I compare the entire data set or I have to select few columns and then compare? Also, is there a link where I can check how to write the proc compare statement?

3 REPLIES 3
Quentin
Super User

Yes, PROC COMPARE can compare entire datasets. 

 

See the documentation:

 

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n1nwxbchh5hpu1n1h28kmici2awd.htm

 

proc compare base=dataset1 compare=dataset2;
  id PatientID;  *Almost always you want an ID statement, otherwise it will compare by row;
run;
  

 

The Boston Area SAS Users Group is hosting free webinars!
Next up: Rick Wicklin presents Ten Tips for Effective Statistical Graphics (with SAS code) on Wednesday March 26.
Register now at https://www.basug.org/events.
kleelasiva9
Obsidian | Level 7

Q: With proc compare can I compare the entire data set or I have to select few columns and then compare?

Ans: Both, but by default proc compare compares entire dataset. Using Var statement restricts the comparison of the values of variables to the ones named in the VAR statement.

 

Q: Also, is there a link where I can check how to write the proc compare statement?

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n1xrf09nbjnxjzn1kdmbcajf1s1v.htm 

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n0c1y14wyd3u7yn1dmfcpaejllsn.htm 

ballardw
Super User

@Sandeep77 wrote:

Hi Experts,

I want to compare two huge data set with lot of rows and columns. With proc compare can I compare the entire data set or I have to select few columns and then compare? Also, is there a link where I can check how to write the proc compare statement?


If you have any doubt about the order of data you may need to consider sorting by variables at sufficient level to identify unique records. If the data is identical other than sort order you will get many mismatches because record 1 is compared with record 1, 2 with 2, 3 with 3 by default.

 

 

 

 

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 749 views
  • 3 likes
  • 4 in conversation