BookmarkSubscribeRSS Feed

Im looking to divide balance by valuation to get an output as dtv.

I have added the calculation in and works if I 'sum' the balance and index valuation but as soon as I take this out I error.

ERROR: It appears that the CALCULATED variable balance was referenced before it was defined.

ERROR: The following columns were not found as CALCULATED references in the immediate query:

balance, val.

I need to do this in stages as this part of my code without the sum will get me the individual account LTV, I then want to group the individual dtv into segments below. Unsure if I can do this in one statement with a CASE statement?

Less than 30%
30 to 50%
50 to 60%
60-75%
75 to 95%
95-100%
100%+

 

proc sql;

create table work.dtv1 as

select

distinct month_date,

balance_outstanding as balance,

curr_index_val as val,

calculated balance/calculated val as dtv

from

gbasel.baseljul14

where optimum_platform = 'Optimum'

and Arrears_lit_stage_code not in ('L4','L5','L6')

order by month_date;

quit;

1 REPLY 1
Ksharp
Super User

It looks like you don't need Calculated any more . since it is used to refer to a new calculated variable .

and also could try function DIVIDE(balance,val)

distinct month_date,

balance_outstanding as balance,

curr_index_val as val,

calculated balance/calculated val as dtv


Xia Keshan

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 1 reply
  • 7039 views
  • 0 likes
  • 2 in conversation