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
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.
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.
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.
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.
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.
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!
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.