DATA Step, Macro, Functions and more

PROC COMAPARE/ FLAG MISSING with array or without

Reply
Occasional Contributor
Posts: 6

PROC COMAPARE/ FLAG MISSING with array or without

Hi All,

your suggestion will bring me a smile. Smiley Happy

 

 

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,

 

Super User
Posts: 23,663

Re: PROC COMAPARE/ FLAG MISSING with array or without

Posted in reply to himalayancat

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. Smiley Happy

 

 

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,

 


 

Ask a Question
Discussion stats
  • 1 reply
  • 44 views
  • 0 likes
  • 2 in conversation