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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1 reply
  • 584 views
  • 0 likes
  • 2 in conversation