As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


User talk:Tge123

From sasCommunity
Jump to: navigation, search

I believe that you created the tip: Tips:Convert_MISSING_to_0? In that tip I corrected your username. Could you update your 'Talk' page?

Terry,

To clarify your post: are you advocating replacing the display of the missing variable with 0, or are you replacing its value with 0? If the latter, you will affect your stats (keep an eye on the Avg variable, below):

/* First example - "normal" missings */
 
options missing='.';
data _null_;
  a=12 ; b=9 ; c=3 ; d=. ;
  Tot=sum(a,b,c,d);
  Avg=mean(a,b,c,d);
  put _ALL_;
run;
 
* Yields: a=12 b=9 c=3 d=. Tot=24 Avg=8 ;
 
/* Second example - replace missing display with 0; does not affect stats */
 
options missing='0';
data _null_;
  a=12 ; b=9 ; c=3 ; d=. ;
  Tot=sum(a,b,c,d);
  Avg=mean(a,b,c,d);
  put _ALL_;
run;
 
* Yields: a=12 b=9 c=3 d=0 Tot=24 Avg=8 ;
 
/* Second example - replace missing value with 0 */
/* Average is now 6, rather than 8 because it is measured across 4 non-missing values */
 
options missing='.';
data _null_;
  a=12 ; b=9 ; c=3 ; d=0 ;
  Tot=sum(a,b,c,d);
  Avg=mean(a,b,c,d);
  put _ALL_;
run;
 
* Yields: a=12 b=9 c=3 d=0 Tot=24 Avg=6 _ERROR_=0 _N_=1 ;

Regards, Andrew 23Mar2010

Jared 26Nov2012: Over two years and nobody caught that Andrew meant 8 but accidentally wrote 6: "Average is now 6, rather than 6..." I fixed it for you ;)