BookmarkSubscribeRSS Feed

Can I have some help on the case statement please, hopefully the logic of what im trying to do is clear, I just need to put it within the correct format please?

Proc sql;
Create table work.sk as
select
Product_End_Date as Product_end_date,
Term as Term,
Launch_Code as launch_code,
LTD_Pipeline as Pipeline_ytd,
LTD_Completions as Completions_ytd,
CATX(",", product_end_date, term, launchcode)as Date_Term_Prod,
Term_hedge_2 as Term_hedge_2 ,
Prepayment_rate_hedge_2 as Prepayment_rate_hedge_2,
Conversion_Rate_hedge as Conversion_Rate_hedge,
Key_hedge as Key_hedge,
Product_Term_comps as Product_Term_comps,

case
when Date_Term_Prod = Key_hedge then Conversion_Rate_hedge else 0 as Alco_pc,
Case
when Product_Term_comps = Term_hedge_2 then Prepayment_rate_hedge_2 else 0 end as prepayment

From Hedging_Dataset;
quit;

1 REPLY 1
Tom
Super User Tom
Super User

The first one is missing the END keyword before the AS keyword

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 651 views
  • 0 likes
  • 2 in conversation