BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Cykelops
Obsidian | Level 7

Hi,

 

Got this code but unable to debug.

 

proc sql;
select
waterfall_frb_ny,
sum (curr_upb_nb) as upb format = comma20.2
from PledgeDataLoanLevel8 /*** PB HE (MSP156) FRB NY ***/
group by waterfall_frb_ny
order by waterfall_frb_ny
;
quit;

 

please help.

Cykelops

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

From the code shown that means that your variable Curr_upb_nb is not numeric.

Since you apparently updating previous code that may indicate that something changed in the file read to create the dataset. A common issue is using Proc Import to read data sources and someone sneaks in a value like "N/A", "not recorded", "Missing" or similar in some records making Import think the column should be character.

 

You may be able to fix this query by including a conversion to numeric but should go fix the source data set.

proc sql;
   select
   waterfall_frb_ny,
   sum (input(curr_upb_nb, 32.) ) as upb format = comma20.2
   from PledgeDataLoanLevel8 /*** PB HE (MSP156) FRB NY ***/
   group by waterfall_frb_ny
   order by waterfall_frb_ny
;
quit;

This is likely to throw some invalid data messages. If there many then share some examples.

 

 


@Cykelops wrote:

Hi,

 

Got this code but unable to debug.

 

proc sql;
select
waterfall_frb_ny,
sum (curr_upb_nb) as upb format = comma20.2
from PledgeDataLoanLevel8 /*** PB HE (MSP156) FRB NY ***/
group by waterfall_frb_ny
order by waterfall_frb_ny
;
quit;

 

please help.

Cykelops

 


 

View solution in original post

3 REPLIES 3
Tom
Super User Tom
Super User

The message is pretty clear.  The only SUM() in your code is being applied to curr_upb_nb.  So that variable is character, but it would need to be numeric for you to add up the values.

 

The issue is probably in whatever step created the PledgeDataLoanLevel8 dataset.  Check that step and make sure that it is defining curr_upb_nb as a number and not a character variable.

ballardw
Super User

From the code shown that means that your variable Curr_upb_nb is not numeric.

Since you apparently updating previous code that may indicate that something changed in the file read to create the dataset. A common issue is using Proc Import to read data sources and someone sneaks in a value like "N/A", "not recorded", "Missing" or similar in some records making Import think the column should be character.

 

You may be able to fix this query by including a conversion to numeric but should go fix the source data set.

proc sql;
   select
   waterfall_frb_ny,
   sum (input(curr_upb_nb, 32.) ) as upb format = comma20.2
   from PledgeDataLoanLevel8 /*** PB HE (MSP156) FRB NY ***/
   group by waterfall_frb_ny
   order by waterfall_frb_ny
;
quit;

This is likely to throw some invalid data messages. If there many then share some examples.

 

 


@Cykelops wrote:

Hi,

 

Got this code but unable to debug.

 

proc sql;
select
waterfall_frb_ny,
sum (curr_upb_nb) as upb format = comma20.2
from PledgeDataLoanLevel8 /*** PB HE (MSP156) FRB NY ***/
group by waterfall_frb_ny
order by waterfall_frb_ny
;
quit;

 

please help.

Cykelops

 


 

Cykelops
Obsidian | Level 7

Thank you so much! It works.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 2190 views
  • 1 like
  • 3 in conversation