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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 564 views
  • 0 likes
  • 2 in conversation