Hello team,
I code as follows:
if member_ID in ('k') then tempbucket = 'Health plan v';
Proc sql;
create table mydata as
select distinct a.member_ID
from tablec a;
quit;
Now I want to add this tempbucket to my table.
Can you please let know how?
I have searched a lot!
Regards,
Blue Blue
How can I do that?
Thanks for the response.
Let me try it tomorrow and I will get back to you:
Does this add a new variable? Or test different cases? Anyway, case statement can solve my situation.
If it is not "k only" it is "k" or "n", then what happens? I mean to use "or" with "in".
Can we bring our new variable after the word "case"?
Proc sql; create table mydata as select distinct a.member_ID ,case when a.member_ID in ('k') then 'Health plan v' else '' end as tempbucket from tablec a; quit;
Regards,
Blue, Blue
In SQL the CASE statement can do similar logic:
Proc sql;
create table mydata as
select distinct a.member_ID
,case
when a.member_ID in ('k') then 'Health plan v'
else ''
end as tempbucket
from tablec a;
quit;
Thanks for the response.
Let me try it tomorrow and I will get back to you:
Does this add a new variable? Or test different cases? Anyway, case statement can solve my situation.
If it is not "k only" it is "k" or "n", then what happens? I mean to use "or" with "in".
Can we bring our new variable after the word "case"?
Proc sql; create table mydata as select distinct a.member_ID ,case when a.member_ID in ('k') then 'Health plan v' else '' end as tempbucket from tablec a; quit;
Regards,
Blue, Blue
Please read the documentation and try running the code. If it is still not clear then ask further questions.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: