BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
srussell
Calcite | Level 5

I have two data sets.... one contains Billing Information and the other contains payments / adjustments.  The output of a join for the two sets has created a set of records where there have been no payments or adjustments causing the two fields (Cash and Adjustments) be flagged as Missing (.) on those records.

 

In order to calcluate Total AR as well as the current Invoice Balance, I need the Missing (.) to show as zero (0).

 

I've read several posts on this topic and thought I had a solution, however I'm getting a mixed bag of results with my variations:

 

IFN(t1.'Cash Applied'n > 0 or t1.'Cash Applied'n < 0, t1.'Cash Applied'n, 0, 0) -  Populates accurate original data (both positive and negative) when it was NOT missing but does NOT convert missing (.) to zero (0).

 

IFN(t1.'Cash Applied'n > 0, t1.'Cash Applied'n, 0, 0) - Populates original data (only if positive - negatives are lost) AND successfully converts missing (.) to zero (0).

 

IFN(t1.'Cash Applied'n < 0, t1.'Cash Applied'n, 0, 0) - Populates original data (only if negative - positives are lost) but does NOT convert missing (.) to zero (0).

 

I've even tried pulling negatives out and adding them back after a successful positive conversion, but it then reverts the value back to missing.  Essentially, the missing (.) to zero (0) conversion works great for positive numbers, and fails anytime I try to handle the negative values.

 

Any feedback you guys can provide would be greatly appreciated.

 

SAS EG 7.1 (64 bit)

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Is there some reason you don't want to use the MISSING function to test for a missing value?

 

When you compare . < 0 the result is true so your t1.'Cash Applied'n > 0 or t1.'Cash Applied'n < 0 will resolve to true when the variable value is missing, not missing for the comparison.

 

A case statement using when missing(t1.'Cash Applied'n) might be a better approach.

View solution in original post

3 REPLIES 3
ChrisHemedinger
Community Manager

Did you look at the tips in this post: How to set all missing values to zero?

 

PROC STDIZE might be the easiest thing, using REPONLY and MISSING=0.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
ballardw
Super User

Is there some reason you don't want to use the MISSING function to test for a missing value?

 

When you compare . < 0 the result is true so your t1.'Cash Applied'n > 0 or t1.'Cash Applied'n < 0 will resolve to true when the variable value is missing, not missing for the comparison.

 

A case statement using when missing(t1.'Cash Applied'n) might be a better approach.

srussell
Calcite | Level 5

Your mention of the Missing function got me to thinking more along those lines and I was able to use it to identify those records with missing data and then update to zero based on that result.  Gave me the result I needed.

 

Thanks for your help.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 7973 views
  • 0 likes
  • 3 in conversation