I want to covert a regular code (below) into a macro that will produce either the frequency report or the descriptive statistics report based on a value of a parameter that is passed to the macro.*/; Original code /*frequency report for month*/;
proc means data=VIRGINIAKEY N ; var month; class month;run;
/*lists basic descriptive statistics (N, mean, standard deviation, minimum, and maximum) for air temperature*/;
proc means data=VIRGINIAKEY ; var AirTemp; run; Myy Current trial code: %macro freq_Describe (MNTH=month AIR_Temp=AirTemp );
/*frequency report for month*/;
proc means data=VIRGINIAKEY N ; var &MNTH.; class &MNTH.;run;
/*lists basic descriptive statistics (N, mean, standard deviation, minimum, and maximum) for air temperature*/;
proc means data=VIRGINIAKEY ; var &AIR_Temp.; run;
%mend freq_Describe;
%freq_Describe (MNTH=month ; AIR_Temp=AirTemp); usiing my trial code, I got several errors NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE MEANS used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: Line generated by the invoked macro "FREQ_DESCRIBE". 81 proc means data=VIRGINIAKEY ; var &AIR_Temp.; run; _ 22 200 WARNING: Apparent symbolic reference AIR_TEMP not resolved. ERROR 22-322: Syntax error, expecting one of the following: a name, ;, /, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_. ERROR 200-322: The symbol is not recognized and will be ignored. NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE MEANS used (Total process time): real time 0.00 seconds cpu time 0.01 seconds NOTE: Line generated by the macro variable "MNTH". 81 month ; AIR_Temp=AirTemp ________ 180 NOTE: Line generated by the macro variable "MNTH". 81 month ; AIR_Temp=AirTemp ________ 180 ERROR 180-322: Statement is not valid or it is used out of proper order. 82 83 84 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 96 Any advice will be greatly appreciated.
... View more