BookmarkSubscribeRSS Feed
Anandu
Calcite | Level 5

i found this question in an exam and was confused. In the question it was mentioned two datasets were validated using proc compare and the values were exact match but the observation number was different one has observation n=5 other n=6 so. The question was is the validation success or failure

4 REPLIES 4
yabwon
Onyx | Level 15

code:

resetline;
data a;
  do x=1 to 5;
    output;
  end;
run;
data b;
  do x=1 to 6;
    output;
  end;
run;

proc compare base=a compare=b;
run;

log:

11
12   proc compare base=a compare=b;
13   run;

NOTE: There were 5 observations read from the data set WORK.A.
NOTE: There were 6 observations read from the data set WORK.B.
NOTE: PROCEDURE COMPARE used (Total process time):
      real time           0.03 seconds
      user cpu time       0.04 seconds
      system cpu time     0.00 seconds
      memory              8057.07k
      OS Memory           30208.00k

output:

yabwon_0-1695712384334.png

 

log with SYSINFO:


14
15   %put * &=SYSINFO. *;
* SYSINFO=128 *

after looking at the SYSINFO return codes here: 

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n1jbbrf1tztya8n1tju77t35dej9.htm#n0301m0...

With value 128 - I would say: "Comparison Failed". In general everything greater or equal 64 I consider a fail (sometimes 16 too).

 

Bart

 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Anandu
Calcite | Level 5
So then what is the answer does the validation with difference in observation but with same value. Got succeeded or failed due to difference in number of observation. It was an exam question MCQ
ballardw
Super User

What criteria were provided in the question for determining success or failure?

 

That could depend on why someone runs proc compare and the situation or reason determines the "success" or "failure".

Consider: I am running code on an update source file that is expected to have more observations than an older file. But I am looking to see if my process on the updated source produces the same results for some of the records. That has a different "success" than if I am recovering an backup, for example, and want to verify that the compared data set exactly matches the archive copy.

 

If there is not more description to the problem to be solved in regards to any value judgement (success or failure) then the question is poorly constructed as it is lacking in details.

Quentin
Super User

@Anandu wrote:
So then what is the answer does the validation with difference in observation but with same value. Got succeeded or failed due to difference in number of observation. It was an exam question MCQ

I vote failed.  Especially if the question was about validating a dataset.  It's possible if someone said "validating the data in the smaller dataset" they might claim it passed, but if I had to choose for a test, I'd definitely choose failed.

 

I love the ERROR option for proc compare when validating data.

 

12   proc compare base=a compare=b error;
13   run;

ERROR: Data set WORK.B contains 1 observations not in WORK.A.
ERROR: The data sets WORK.A and WORK.B do not contain the same data. One or both data
       sets contain variables or observations not in the other. However, all comparisons
       are equal for the data in common.
NOTE: There were 5 observations read from the data set WORK.A.
NOTE: There were 6 observations read from the data set WORK.B.
The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.

Welcome to the Certification Community

 

This is a knowledge-sharing community for SAS Certified Professionals and anyone who wants to learn more about becoming SAS Certified. Ask questions and get answers fast. Share with others who are interested in certification and who are studying for certifications.To get the most from your community experience, use these getting-started resources:

Community Do's and Don'ts
How to add SAS syntax to your post
How to get fast, helpful answers

 

Why Get SAS Certified.jpg

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
  • 2588 views
  • 5 likes
  • 4 in conversation