The final statement im trying to add 'Age' plus 'Year but It doesnt work, I just get a a full stop, anyone know why my code wont add the 2 variable, both numeric?
I have had to create 'Customer age profile' to obtain the 'Age' and a second statement 'Term years to get the 'Year'. Im then joining the 2 tables to create the third statement 'Add age and year'.
/*Customer Age Profile*/
proc sql;
create table work.borrower_age as
select
AccountNo as accnum,
int(yrdif(DATE_OF_BIRTH,today(),'ACTUAL')) as Age
from
green.optimum201302;
quit;
/*Term Years*/
proc sql;
create table work.term_years as
select
distinct month_date,
accnum,
round(remaining_term_months/12,1) as year
from work.dataset_basel;
quit;
/*Add Age and Year*/
proc sql;
create table work.age_at_term as
select
b.month_date,
a.accnum,
a.age + b.year as age_term
from
work.borrower_age as a
left join work.term_years as b
on a.accnum = b.accnum;
quit;
Try this.
proc sql;
create table work.age_at_term as
select
b.month_date,
a.accnum,
sum(a.age, b.year,0) as age_term
from
work.borrower_age as a
left join work.term_years as b
on a.accnum = b.accnum;
quit;
That seems to work on the adding the 2 variables thanks, but now month_date shows just a full stop now?
Does this happen after making changes in syntax?
I have just tested it and it appears to have the full stop before the syntax change, any reason as to why this might be?
Not sure about your data structure. I would suggest check your source tables to validate this.
Ive just been sampling the data and the year and age isn't adding up either. I didn't check it correctly in the first instance sorry so im still requiring help on this.
What are you getting in age_term variable?
You have to provide more info for us to tell you why something doesn't work, specifically how isn't it correct.
If you can replicate the problem with fake data and post the fake data and code here.
It would be easy to get a solution if you give use the data what you have and what you want. With out ooking at the data, its not that easy to solve.
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.
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.