Posted By

webonomic on 01/22/11


Tagged

missing sum


Versions (?)

Store a zero value in place of missing when reporting numeric values


 / Published in: SAS
 

URL: http://www.sascommunity.org/wiki/Tip_of_the_Day:November_25

  1. /*I often need to store a 0 value in place of missing when reporting numeric values. I take advantage of the SUM function for this purpose. For each variable I sum itself with 0 as in:*/
  2.  
  3. COST=SUM(COST,0);
  4.  
  5. /*The SUM function ignores missing values. So if COST is not missing, no change occurs. If COST is missing, it is now 0.
  6. If only the display of missing values as 0 as needed, use the options statement (which does not change the internal value):*/
  7.  
  8. options missing = '0 ';

Report this snippet  

You need to login to post a comment.