BookmarkSubscribeRSS Feed
GN0001
Barite | Level 11
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

Blue Blue
2 REPLIES 2
Tom
Super User Tom
Super User

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
;
GN0001
Barite | Level 11

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

Blue Blue

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

Register Now

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
  • 2 replies
  • 1274 views
  • 1 like
  • 2 in conversation