05-10-2016 09:51 AM
Symput -> puts the character string into the macro symbol table
Symget -> gets the character srting from the macro symbol table
data _null_; call symput('MVAR',"This is a macro variable character string"); run; data want; avar=symget('MVAR'); run;
05-12-2016 02:40 PM
05-13-2016 03:59 AM
Just to note on that @Rick_SAS, even if you use symputx() the result is still a character string. Macro only has string datatype (in fact its not even a datatype eveything is string). Whilst symputx() converts the number do be aware that:
specifies a character or numeric constant, variable, or expression. If value is numeric, SAS converts the value to a character string using the BEST. format and does not issue a note to the SAS log. Leading and trailing blanks are removed, and the resulting character string is assigned to the macro variable.
This means that the resulting text string may not be what you want, I would always advise put()'ing the numeric variable into the format you want rather than letting SAS guess.
05-13-2016 10:04 AM - edited 05-13-2016 10:05 AM
Yes. All macro variables are character values that get substituted into programs when the SAS pre-processor runs. That is spelled out explicitly in the blog post that I linked to.