Passing Various Quantities of a Parameter to Stored Processes

0

If you need to give your users the ability to select multiple OR no values within a selection box, the stored process needs to be capable of addressing this flexibility. For the example below, users wanted to choose 0 to 3 severities (of 4) to exclude from the results.

%macro datastep;
data temp;
set table name;
/*test to make sure more than 1 severity was selected*/
%IF %length(&severity;) > 0 %THEN %DO ;
/*test to make sure only 1 severity was selected*/
%if %SYMGLOBL(severity0) EQ 0 %then %do;
if severity = &severity; then delete;
%end;
%else %do;
/*runs the same code multiple times for each of the severities selected*/
%do i=1 %to &severity0;
if severity = &&severity;&i; then delete;
%end;
%end;
%end;
%mend; 

Share

About Author

Angela Hall

Senior Technical Architect

Angela offers tips on using the SAS Business Intelligence solutions. She manages a team of SAS Fraud Framework implementers within the SAS Solutions On-Demand organization. Angela also has co-written two books, 'Building BI using SAS, Content Development Examples' & 'The 50 Keys to Learning SAS Stored Processes'.

Comments are closed.

Back to Top