BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
arodriguez
Lapis Lazuli | Level 10

Hi everyone and thank you for read it,

Well, I'm trying to do a kind of auto validation. For do these I create a expected output the first time and I

confirm that all is okay.

My first problem appears when I try to use the PROC COMPARE to decide if my validated dataset and me

new dataset are the same. For example, if I compare my base with

data new;

set base

         base;

run;

The proc compare say there are XX line equal and 0 unequal and this is false, there are not the same dataset.

My first question is, Exist any procedure that say you YES/NO to the comparation?
If the answer is NO, there exist any easy way to know if two dataset are exactly the same.

My other question is looking further, I should compare .TXT with other .TXT how can I do it in SAS?

Thanks for the help,

Antonio Rodríguez

1 ACCEPTED SOLUTION

Accepted Solutions
arodriguez
Lapis Lazuli | Level 10

At last I have found how to do it. There is a option in proc compare to put a warning or an error if there is something diferent. I have activated

this option, then I look the content of SYSERRORTEXT or SYSWARNINGTEXT.

View solution in original post

4 REPLIES 4
Reeza
Super User

You're looking for a line that says the following I assume:

Number of Observations in WORK.CLASS2 but not in WORK.CLASS: 19.

I agree the note is misleading, but is actually correct. All compared values were the same, but one had obs not in the other, so those are not comapred.

NOTE: No unequal values were found. All values compared are exactly equal.

If you run with the BriefSummary option you get two notes:

NOTE: Data set WORK.CLASS2 contains 19 observations not in WORK.CLASS.

NOTE: No unequal values were found. All values compared are exactly equal.

Or you could use the OUTSTATS= option and verify in a second step.

arodriguez
Lapis Lazuli | Level 10

This solve part of the problem of understand the proc compare, but if I compere two datasets, with the same variables

and the same values and a different format, for example insteed of $5. put $30. there are not the same dataset, but the

proc compare say that are equal.

Reeza
Super User

RTM.

Proc compare will tell you when variables are different, formats, types, attributes etc you just need to look in different places.

Or roll your own.

Base SAS(R) 9.3 Procedures Guide, Second Edition

arodriguez
Lapis Lazuli | Level 10

At last I have found how to do it. There is a option in proc compare to put a warning or an error if there is something diferent. I have activated

this option, then I look the content of SYSERRORTEXT or SYSWARNINGTEXT.

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
  • 1004 views
  • 4 likes
  • 2 in conversation