Proc sql; create table mytable as select distinct b.this , case when b.rate < 0.35 then '35th' when b.rate < 0.45 then '55th' end as 'current rate'n , case when b.rate < 0.35 then '45th' when b.rate < 0.45 then '65th' end as 'next rate'n , case when b.rate <.35 then (b.rate * 'next rate'n) when b.rate <0.45 then (b.rate * 'next rate'n) end as 'final' from tableb b Left Join tablea a
regards,
blue blue
Is there a question in there somewhere?
Are you looking for the CALCULATED keyword?
select amount
, sum(amount) as total
, amount / calculated total as percent
from have
;
Hello Tom,
I put a case statement in the code to calculate something. I found the answer while I was typing the question.
That was to multiply the label that is create for a case statement with a number. Since the label is a literal, I didn't know how to multiply by a text. I found the solution by mysel.
Thanks for the response.
Blue blue
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.