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
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
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.
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
Thank you so much! It works.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.