Search notes:

SAS macro: createId

%tq84_createId creates a unique identifier. This macro is used in createMacro.

createId.sas

%global tq84_idCounter;
%let    tq84_idCounter = 0;

%macro tq84_createId(prefix);

   %local  idRet;

   %let  idRet = &prefix&tq84_idCounter._;
   %let  tq84_idCounter = %eval(&tq84_idCounter + 1);

   &idRet

%mend  tq84_createId;
Github repository about-SAS, path: /macros/createId.sas

Test

%put %tq84_createId(foo); /* foo0_ */
%put %tq84_createId(bar); /* bar1_ */
%put %tq84_createId(baz); /* baz2_ */
%put %tq84_createId(foo); /* foo3_ */
Github repository about-SAS, path: /macros/tests/createId.sas

See also

macros

Index