MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SAS Compare

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
sanjayr321
Beginner


Joined: 25 Sep 2006
Posts: 28
Topics: 15

PostPosted: Mon Aug 09, 2010 1:57 am    Post subject: SAS Compare Reply with quote

Iam running SAS in Enterprise guide 4.

Just want to understand how SAS compare works in the below scenario.
I have two sas datasets with 3 columns

File A
Code:

ENO ENAME FUND1
123  ABC   5000
234  CDE   3000
456  FGH    0

File B
Code:

ENO ENAME FUND1
123  ABC   5000
234  CDE   3000
456  FGH    .

I ran the PROC compare with above two datasets using the code.
Code:

proc compare base=FileA compare=FileB printall;
title 'Comparsion report';
run;

As expected, I got the third obs as unequal and first two as equal.

Again I ran the simple code which creates the file B with
"OPTIONS MISSING = '0'; to replace the '.' with '0'
Code:

I get File B as output
123 ABC   5000
234 CDE   3000
456 FGH    0

I ran the PROC compare again with two sas datasets, ie., File A and new File B.
Still the third obs shows as unequal.

Can you please explain how the SAS internally compare values.
Is the two zeroes are read differently in SAS.
Is there way to overcome this issue.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12370
Topics: 75
Location: San Jose

PostPosted: Mon Aug 09, 2010 10:06 am    Post subject: Reply with quote

sanjayr321,

How is ENO and FUND1 is defined?

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 699
Topics: 63
Location: USA

PostPosted: Mon Aug 09, 2010 2:04 pm    Post subject: Reply with quote

sanjayr321,

Check "MISSING STATEMENT" and "MISSING OPTION" in this link - http://www2.sas.com/proceedings/forum2008/082-2008.pdf

According to this document -
Quote:
The MISSING option allows you to change the character displayed when missing numeric data is encountered.

So you still get same result for compare because it is still missing (not 0).

If you want to change it to zero then probably you need to update the dataset, maybe like -
Code:
 if missing(fund1) then fund1 = 0;

_________________
Regards,
Diba
Back to top
View user's profile Send private message Send e-mail
sanjayr321
Beginner


Joined: 25 Sep 2006
Posts: 28
Topics: 15

PostPosted: Mon Aug 09, 2010 6:44 pm    Post subject: Reply with quote

Kolusu,
ENO and FUND1 are defined as numeric.

Dibakar,
Thanks, I am experiencing the same issue for more of number fields, if I want to
update each fields it will make the program lengthy and messy.

Is there any other options which we can declare universally.
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Mon Aug 09, 2010 8:05 pm    Post subject: Reply with quote

Quote:

if I want to update each fields it will make the program lengthy and messy.
Longer (more code) most likely, but that is no reason for the code to be messy. . .
_________________
All the best,

di
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 699
Topics: 63
Location: USA

PostPosted: Wed Aug 11, 2010 5:02 pm    Post subject: Reply with quote

Quote:

Thanks, I am experiencing the same issue for more of number fields, if I want to
update each fields it will make the program lengthy and messy.


Check if COMPARE with NOMISS option makes any difference -

Code:
proc compare base=FileA compare=FileB printall NOMISS;

_________________
Regards,
Diba
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group