BookmarkSubscribeRSS Feed
swathi123
Obsidian | Level 7

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.

5 REPLIES 5
LinusH
Tourmaline | Level 20

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
swathi123
Obsidian | Level 7

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

ballardw
Super User

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.

devnand
Obsidian | Level 7

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 */

%include test1;

If test.sas contains %let XYZ=14


When you include

%put &XYZ = ;


You should not get the error.

I hope this would help.

Tom
Super User Tom
Super User

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 ;

  input;

  put _infile_;

run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 969 views
  • 0 likes
  • 5 in conversation