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.
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.