/* -------------------------------------------------------- */ /* multi.sas - Reads multi select from the browse */ /* -------------------------------------------------------- */ %global FIXINS; %global FIXINS0 FIXINS1; options nosource nonotes; %out2htm(capture=on, window=log ); /* ____________________________________ */ /* Make the "0" and "1" macro variables */ /* if necessary. Simplifies later code */ /* _____________________________________ */ %macro prep; data _null_; %IF %superq(FIXINS)= %THEN %DO; /* no parameters */ call symput("FIXINS0","0"); %END; %ELSE %DO; /* at least 1 */ %IF %superq(FIXINS0)= %THEN %DO; /* just 1 */ call symput("FIXINS0","1"); %END; %END; call symput("FIXINS1",symget("FIXINS")); run; %mend prep; %prep /* ----------------------- */ /* use the macro variables */ /* ----------------------- */ %macro use; data _null_; %IF %superq(FIXINS0)=1 %THEN %DO; put "You ordered %superq(FIXINS0) topping."; %END; %ELSE %DO; put "You ordered %superq(FIXINS0) toppings."; %END; %IF %superq(FIXINS0) ne 0 %THEN %DO fx= 1 %TO %superq(FIXINS0); f=symget("FIXINS&fx"); put f; %END; run; %mend use; %use %out2htm(htmlfref=_webout, capture=off, window=log, runmode=s, openmode=replace); %let FIXINS=; %let FIXINS0=; %let FIXINS1=;
back to the overview