Hi:
I have a do loop that calls a macro and runs a series of 13 data procedures before ending the loop. Early on, at data step 7, I would know whether a series of variables within the dataset created in that step have certain values. There is a single observation in the dataset. To save time, I want to evaluate the variable's values and, if they fail to meet certain conditions, I want to end the macro and skip to the next iteration of the loop. However, If the conditions are met, I want to finish the macro's remaining steps and go to the next iteration of the loop. What is the best way to accomplish that? Thanks
In a data step where you having this single observation, and you do the evaluation of whether or not the conditions are met, create a 0 or 1 variable named condition_met, then
call symputx('condition_met',condition met);
This creates a macro variable &CONDITION_MET, then in your macro
%if &condition_met %then %do;
/* Remaining steps of the macro */
%end;
In a data step where you having this single observation, and you do the evaluation of whether or not the conditions are met, create a 0 or 1 variable named condition_met, then
call symputx('condition_met',condition met);
This creates a macro variable &CONDITION_MET, then in your macro
%if &condition_met %then %do;
/* Remaining steps of the macro */
%end;
Thanks for the fast reply. I completely understand the second part. Its creating the "condition met" as a 0 or 1 that is the stumbling block.
Here is the condition met logic for the variables:
if bluneconomic<0 and blironore>0 and blscrap>0 and blixrate<0 and blgfcf<0 and blalum<0 and bluneconomica<.05 and blironorea<.05 and blscrapa<.05 and blixratea<.05 and blgfcfa>.05 and blaluma<.05
call symputx('condition_met',bluneconomic<0 and blironore>0 and
blscrap>0 and blixrate<0 and blgfcf<0 and blalum<0 and
bluneconomica<.05 and blironorea<.05 and blscrapa<.05 and
blixratea<.05 and blgfcfa>.05 and blaluma<.05);
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.