BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have been given an EG process flow to maintain, and one of the code segments creates a work table by formatting character data from an input file. I need to create a new column in this table by adding 4 dollar fields to get the value for the new column.

I don't get any errors, but I don't get any output in the new column either (data column shows '.'). My code is:

(Input(put(&importfilename..Disb_1_Net_Amt,$8.),17.2)) FORMAT=DOLLAR17.2 AS Disb_1_Net_Amount,
(Input(put(&importfilename..Disb_2_Net_Amt,$8.),17.2)) FORMAT=DOLLAR17.2 AS Disb_2_Net_Amount,
(Input(put(&importfilename..Disb_3_Net_Amt,$8.),17.2)) FORMAT=DOLLAR17.2 AS Disb_3_Net_Amount,
(Input(put(&importfilename..Disb_4_Net_Amt,$8.),17.2)) FORMAT=DOLLAR17.2 AS Disb_4_Net_Amount,

/* new column */
((CALCULATED Disb_1_Net_Amount) + (CALCULATED Disb_2_Net_Amount)
+ (CALCULATED Disb_3_Net_Amount) + (CALCULATED Disb_4_Net_Amount))
FORMAT=DOLLAR17.2 AS Total_Disb_Net_Amount,

What am I doing wrong? Thanks.
2 REPLIES 2
Doc_Duke
Rhodochrosite | Level 12
Does your query show data in the ...Net_Amount fields? Are they all there?

One possibility:
By using the "+" operator, if any of the component parts are missing, the result is missing. If you have missing pieces and the sum is still meaningful, use the SUM function to add them up.
deleted_user
Not applicable
That did it. Some of the Net Amount fields were null/blank '.'

The new code of

SUM(CALCULATED Disb_1_Net_Amount,CALCULATED Disb_2_Net_Amount, CALCULATED Disb_3_Net_Amount,CALCULATED Disb_4_Net_Amount) FORMAT=DOLLAR17.2 AS Total_Disb_Net_Amount,

works like a charm. Thank you.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1378 views
  • 0 likes
  • 2 in conversation