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

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
Calcite | Level 5

Thank you so much! It works.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

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