BookmarkSubscribeRSS Feed
🔒 This topic is locked. We are no longer accepting replies to this topic. Need further help? Please sign in and ask a new question.
SAS_Tipster
Moderator

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:

 

COST = SUM(COST, 0);

The SUM function ignores missing values. So if COST is not missing, no change occurs. If COST is missing, it is now 0.

If only the display of missing values as 0 as needed, use the options statement (which does not change the internal value):

 

options missing = '0 ';
 
Originally posted by Terry on sasCommunity.org.
1 REPLY 1
Ksharp
Super User
proc stdize data=sashelp.class out=want missing=0 reponly;
var weight;
run;

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!

Visit a random SAS tip This SAS Tips board is not open for replies or comments, but we welcome your feedback and questions. Have a question or comment about this tip? Start a new topic in one of our discussion boards, and reference this tip topic.
Discussion stats
  • 1 reply
  • 2772 views
  • 7 likes
  • 2 in conversation