pobel 发表于 2010-9-15 11:49 
data _null_;
do i=1 to 10;
call symput("num"||strip(i),i);
end;
run;
It is a good practice to use call symputx rather ther call symput.
Here is the reasons.
CALL SYMPUTX is similar to CALL SYMPUT except that
- CALL SYMPUTX does not write a note to the SAS log when the second argument is numeric. CALL SYMPUT, however, writes a note to the log stating that numeric values were converted to character values.
- CALL SYMPUTX uses a field width of up to 32 characters when it converts a numeric second argument to a character value. CALL SYMPUT uses a field width of up to 12 characters.
- CALL SYMPUTX left-justifies both arguments and trims trailing blanks. CALL SYMPUT does not left-justify the arguments, and trims trailing blanks from the first argument only. Leading blanks in the value of name cause an error.
- CALL SYMPUTX enables you to specify the symbol table in which to store the macro variable, whereas CALL SYMPUT does not.