Different methods produce different results
- data tm;
- input ID $ name $ ;
- cards;
- ZP0001 zhang1
- ZP0002 wang2
- ZP0003 lisan
- ZP0004 zhaosi
- ;
- data tm1;
- set tm;
- length filename $ 15;
- filename=strip(catt(ID,name));
- call symput(filename, filename); /* create a macro for each observation */
- run;
- proc sql noprint;
- select filename into :filename_1 - :filename_100 /* create a macro for each observation */
- from tm1; /* this 100 should > total number of observations */
- /* if 100<nobs then create 100 macro variables */
- select filename into : filename /* create a macro variable from the first observation */
- from tm1;
-
- select filename into : all_filename separated by ' ' /* create one macro variable for all obs */
- from tm1; /* and the filenames are separated by a space */
- quit;
复制代码