06-17-2013 04:19 PM
I am writing a code in SAS.
I have preexisting Macro variables in my envt which resolve
to something. How do I know where they are defined in unix solaris? Any
particular command I can use to see where the envt variables are defined in a
If at all I need to create a new macro var &xyz where do I create it? And how to write it?
I used %let XYZ=%sysget(XYZ);
I see the following error in the log: SYMBOLGEN: Macro variable XYZ resolves to
But I do not see anything after resolves to – meaning it is not
resolved. Any suggestions appreciated.
I am not sure if this is an environmental specific question, but
thought I’d ask anyways.. Thanks.
06-17-2013 04:55 PM
A bit confused about your requirement.
Do you wish to use an existing environment variable? If so, contact the responsible party for defining such variables, whoever that can be.
Or do want to how to define a macro variable as such? Macro variables can be defined anywhere in SAS programs, best place depends on your situation. So, please describe in more detail what kind of macro variable yo9uo need, and do you intend to use it.
06-17-2013 05:16 PM
Using existing variable is what i need. How do i define them? where do i locate them?
in order for me to write a new envtl variable i need to first understand the existing envtl variables right?
Hope I was clear
06-17-2013 07:00 PM
If you are talking about reading environment variables, SAS generally isn't involved with setting them, they mostly come from the operating system. So where they are set dependins on your OS and environment. The exceptions would be those created using SET in the SAS configuration file.
I haven't found anything that allows SAS to send values to environment variables unless you want to think of RSUBMIT login information for database access as such.
If the environment variable XYZ in your example wasn't set by the OS then you wouldn't get anything.
06-17-2013 06:59 PM
I am assuming that you have a macro somewhere in a directory. Just call the macro using %include statement. Eg,
filename test1 '/home/o568484/test.sas'; /*directory for the location of the macro in unix */
If test.sas contains %let XYZ=14
When you include
%put &XYZ = ;
You should not get the error.
I hope this would help.
06-17-2013 08:40 PM
If you want to see what macro variables are defined currently then use %PUT _ALL_; or %PUT _GLOBAL_;
If you want to see what ENVIRONMENT variables were defined before SAS started then you will need to use operating system commands. You could try this simple data step which should work on Unix or Windows.
infile 'set' pipe ;