Hi all, I have a question for using "if statement". I created a static list prompt. When selected, prompt outputs following variables: %LET Selected_Scenarios_count = 3; %LET Selected_Scenarios = Base; %LET Selected_Scenarios0 = 3; %LET Selected_Scenarios3 = Down; %LET Selected_Scenarios1 = Base; %LET Selected_Scenarios2 = Up; Here I share a sample piece of my code. I am using proc sql within sas macro. In the bold part I wish to calculate only for the Up and Down scenarios. However the code runs for all the scenarios. Can you help? %macro MY_SAMPLE(); proc sql; create table WORK.MY_SAMPLE_TABLE as select Field1, Field2, %do s=1 %to &Selected_Scenarios_count.; sum(Name_&&selected_scenarios&s..) as Name_&&selected_scenarios&s.., if &&selected_scenarios&s.. in('Up', 'Down') then do; sum(Name3_&&selected_scenarios&s.._Y&y.) as Name3_&&selected_scenarios&s.., %end; %end; Field5 from WORK.MY_SOURCE group by 1,2 ;quit; %mend MY_SAMPLE; %MY_SAMPLE();
... View more