DATA Step, Macro, Functions and more

Macro variable not resolving ??

Posts: 27

Macro variable not resolving ??

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
common location?

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);

%put XYZ=&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.

Super User
Posts: 5,255

Re: Macro variable not resolving ??

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.

Data never sleeps
Posts: 27

Re: Macro variable not resolving ??

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

Super User
Posts: 10,483

Re: Macro variable not resolving ??

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.

Posts: 39

Re: Macro variable not resolving ??

I am assuming that you have a macro somewhere in a directory. Just call the macro using %include statement. Eg,

filename test1 '/home/o568484/'; /*directory for the location of the macro in unix */

%include test1;

If contains %let XYZ=14

When you include

%put &XYZ = ;

You should not get the error.

I hope this would help.

Super User
Super User
Posts: 6,499

Re: Macro variable not resolving ??

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.

data _null_;

  infile 'set' pipe ;


  put _infile_;


Ask a Question
Discussion stats
  • 5 replies
  • 5 in conversation