if Alpha=2 then plan =3;
if Alpha=3 then plan =1;
else if Alpha=4 then plan =0;
if Beta=2 then plan =2;
else Beta=3 then plan =1;
else if Beta=4 then plan =0;
I want to get the minimum/lower plan under the below condition? so as an answer I need beta here
if Alpha=2 then plan =3;
if Beta=2 then plan =2;
If I understand you correctly, create two variables (plan_Alpha and plan_Beta) instead of one. Then it's easy to obtain the result you describe:
if alpha=beta=2 then plan = min(plan_alpha, plan_beta);
Assuming you have correctly calculated Alpha and Beta (and looking at your logic it appears it needs a little cleaning up), you could use:
plan = min(alpha, beta);
To get that, you will need to show more of the data. What you posted doesn't illustrate either variable "hitting 2".
If I understand you correctly, create two variables (plan_Alpha and plan_Beta) instead of one. Then it's easy to obtain the result you describe:
if alpha=beta=2 then plan = min(plan_alpha, plan_beta);
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.