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

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