BookmarkSubscribeRSS Feed
himalayancat
Fluorite | Level 6

Hi All,

your suggestion will bring me a smile. 🙂

 

 

i ran a proc compare:

***step 1***

proc compare base=mybasefie    compare=mycomparefile
outdiff out=out_all_diff
run;

 

**********my resuslt are like below******note#sal(numeric) age(numeric)********

 

_type_  _obs_   name      location   sal                 age                date

Dif         1          .......        ........        0.0000          0.00               01/01/1960

Dif         2          .......        ........        0.00              0.0                 01/01/1960

Dif         3         .......        ........        0.000             0.000            01/01/1960

Dif         4         .......        ........        0                    0                   01/01/1960

 

 

*********************what do i want*************

1.when date values are matched does sas display 01/01/1960??

 

2.i want to either flag or put a log if all charcter values missing and numeric are zeros(which means my both datasets are matched)

#i am thinking if somewhat below logic,but not working


data cmpnew.done;

set Cmpnew.compared_jul_unqual;

 

array numit _numeric_;
array charit _charter_;


do over numit ;

do over charit;


if charit=. and numit=0 then do;


put " all values equal";

end;
else do;


put " all is not equal";

end;
run;

 

 

Thank you for you kind help,

 

1 REPLY 1
Reeza
Super User

You probably want to look at FUZZ or CRITERION first. 

 

The differences are really small, and when that value is formatted, it looks like January 1, 1960. 

Computers cannot store numbers as precisely as we'd like so the subtraction returns a small difference when there's really not a difference. Using FUZZ to limit the differences is a good way to avoid this. Once that's done then you can decide what you should do next. 

 


@himalayancat wrote:

Hi All,

your suggestion will bring me a smile. 🙂

 

 

i ran a proc compare:

***step 1***

proc compare base=mybasefie    compare=mycomparefile
outdiff out=out_all_diff
run;

 

**********my resuslt are like below******note#sal(numeric) age(numeric)********

 

_type_  _obs_   name      location   sal                 age                date

Dif         1          .......        ........        0.0000          0.00               01/01/1960

Dif         2          .......        ........        0.00              0.0                 01/01/1960

Dif         3         .......        ........        0.000             0.000            01/01/1960

Dif         4         .......        ........        0                    0                   01/01/1960

 

 

*********************what do i want*************

1.when date values are matched does sas display 01/01/1960??

 

2.i want to either flag or put a log if all charcter values missing and numeric are zeros(which means my both datasets are matched)

#i am thinking if somewhat below logic,but not working


data cmpnew.done;

set Cmpnew.compared_jul_unqual;

 

array numit _numeric_;
array charit _charter_;


do over numit ;

do over charit;


if charit=. and numit=0 then do;


put " all values equal";

end;
else do;


put " all is not equal";

end;
run;

 

 

Thank you for you kind help,

 


 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 688 views
  • 0 likes
  • 2 in conversation