As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Parse sysparm

From sasCommunity
Revision as of 09:23, 14 June 2007 by Rjf2 (Talk | contribs)

Jump to: navigation, search
%*parse-sysparm.sas;
;/* testing in program ****** **
options source2;%* for put _global_;
options sysparm = 'a=1;b=2;d=4';
;/***** ********************* */

DATA   _Null_;
attrib Stmnt   length = $132
       Testing length =    4;
retain Testing %eval(0
       or "%sysfunc(getoption(Source2))"
                          eq "SOURCE2"
       or "%sysfunc(getoption(Verbose))"
                          eq "VERBOSE"  );
if "&SysParm." ne "" then do;
   putlog "SysParm: &SysParm.";
   do I = 1 to %*number of equal-signs;
          length(compress("&SysParm",'=','k'));
      Stmnt= catx(' ' %*separated by space;
                 ,'%let '
                 ,scan("&SysParm.",I,';')
                 ,';');
      if   Testing then putlog Stmnt=;
      call execute(cat('%nrstr(',Stmnt,')'));
      end; %*do I;
   if Testing then
      call execute('%nrstr(%put _global_;)');
   end; %*if "&SysParm." ne "";
stop;
run;    %*calls execute here;
run;

--macro maven == the radical programmer 10:22, 14 June 2007 (EDT)