MAGIC WITH CALL EXECUTE
26. May 2007 11:16Call execute- is a function that can be used if you want to run some code based on the values of a dataset.
Mixing DATA and PROC Steps.
You can't mix DATA and PROC steps. Each SAS step must complete before the next step begins.
For example, this program is illegal:
DATA _NULL_; SET SALES END=NOMORE; TOTAL + AMOUNT; IF NOMORE; IF TOTAL < 1000000 THEN DO; PROC MEANS DATA=SALES; CLASS STATE; END; ELSE DO; PROC MEANS DATA=SALES; CLASS STATE YEAR; END;However, CALL EXECUTE lets you designate the PROC and CLASS statements as statements to be added once the DATA step completes. This approach works, and requires minimal modification to the original:
DATA _NULL_;
SET SALES END=NOMORE;
TOTAL + AMOUNT;
IF NOMORE;
IF TOTAL < 1000000 THEN DO;
CALL EXECUTE
('PROC MEANS DATA=SALES;
CLASS STATE;');
END;
ELSE DO;
CALL EXECUTE
('PROC MEANS DATA=SALES;
CLASS STATE YEAR;');
END;
RUN;sugi22 
Email 
10/8/2011 4:12:58 AM
Thank you for sharing, I really enjoyed your posts and pictures they were great! I think that all of us who follow this blog have that same feeling that you got from visiting.
beijing youth hostels