Zero vs. Null

Accepted Solution Solved
Reply
Contributor
Posts: 49
Accepted Solution

Zero vs. Null

Hello, I was doing a distribution analysis on a single variable. In this particular analysis, the null values as % of total was rather important, however due to calculation balancing, some of my null values went to zero. For the purpose of this study, all zero values are essentially null, however SAS does not see them as such and they get lumped in with my "values" when kicking out useful stats.

In looking around for a solution is seems most people are concerned with going from null to zero and not from zero to null. What is the most efficient way to transform my zero values to "missing"?

TS


Accepted Solutions
Solution
‎01-13-2015 11:41 AM
Super User
Posts: 11,343

Re: Zero vs. Null

Posted in reply to GalacticAbacus

In a datastep:

data want;

      set have;

     if var=0 then var=.;

run;

I would tend to create a new variable though in case I need the original values.

View solution in original post


All Replies
Solution
‎01-13-2015 11:41 AM
Super User
Posts: 11,343

Re: Zero vs. Null

Posted in reply to GalacticAbacus

In a datastep:

data want;

      set have;

     if var=0 then var=.;

run;

I would tend to create a new variable though in case I need the original values.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 212 views
  • 0 likes
  • 2 in conversation