Hi I need to write some code in order to create the logic below within the case statement.
Im not sure how the date coding works so any help would be appreciated?
proc sql;
create table rate as
select *,
case
when Value_Date < today()-365 then tpr, Deal_Int_Rate_pc else 0 end as rate
from adjusted_movement;
quit;
Hi,
You might want to investigate base SAS coding, these are fundamental questions you will need for most coding efforts:
proc sql;
create table rate as
select *,
case when Value_Date < today()-365 then Deal_Int_Rate_pc
else 0 end as rate
from adjusted_movement;
quit;
DOnt know what your trying to acheive with the tpr bit? Maybe you need another when clause. Case is:
case <condition> when <result> then <value> else <value> end
or
case when <condition> then <value> else <value> end
Im trying to replicate what is in excel as a formula
R3 = TPR
K3 = Deal_Int_Rate_pc
=IF(H2<(TODAY()-365),R3,K3)
So:
case when h2_variable < (today()-365) then r3_variable
else k3_variable end as RESULT
There should be a single name or expression in each clause of the case expression
case
when Value_Date < today()-365 then tpr else Deal_Int_Rate_pc end as rate
PG
Thanks, works fine now.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.