11-19-2013 06:45 AM
I am trying to create a CONSTANT or LITERAL in SAS macro language, i mean a variable that can not be changed during the execution of the programme.
Macro Variables created with %let (global or local) can be changed... what i need is to define a variable that can not be changed (the classic example is the number pi=3,14151...). For instance, if I have constant1= 12345, if I writte in my programme %let constant1=789 the constant can not be changed.
In C language it is used the #define function.
11-19-2013 07:19 AM
Have you considered defining a function to return the value you're interested in, would that be of help? E.g.:
%if &const=pi %then
%if &const=e %then
%if &const=c %then
put "e =%constant(e)";
put "c =%constant(c)";
11-19-2013 10:07 AM
For a constant like PI or E see the CONSTANT function.
For constants/literals see
For readonly symbol
11-21-2013 03:44 PM
another option is an environment variable.
yes, they can be changed, but few people are aware of the syntax, nor how to access the symbol table
and so they are more or less, under the radar.
here is the SAS statement syntax:
options set = Evar 'value';
Ron Fehd evar maven