Domanda

On SAS, after defining Macro Language, for example,

   %macro source(x);
   ......
   %mend source;

I want to substitute x for 17 to 63, does there have an easy way to do this instead of key in

%source(16);
%source(17);
...
%source(63);
È stato utile?

Soluzione

You could create a new macro with a do-statement to run you macro a select number of times:

%MACRO RunMacro(from, to);
    %DO i = &from. %TO &to.;
        %source(&i.);
    %END;
%MEND RunMacro;

%RunMacro(16, 63);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top