BookmarkSubscribeRSS Feed
gsreddy
Fluorite | Level 6

How to create a macro variables globally as it should be accessible by ateam of 10-20 members?

2 REPLIES 2
Quentin
Super User

Global macro variables exist within a SAS session. They cannot be shared across SAS sessions.

 

That said, if you have a team and you want every team member to have a group of standard global macro variables (&OurTeam, &OurBoss, &Project, etc.) there are lots of options, most of which would involve sharing code and/or data among the team members.   

 

For example, if you have a shared autoexec, you could define the macro variables there.   To get more meaningful help, I would suggest you describe a bit more about your environment (server SAS, PC SAS, Enterprise Guide, Studio, ....?)  and also what approaches you might have considered/tried already.

BASUG is hosting free webinars ! Check out recordings of our past webinars: https://www.basug.org/videos. Save the date for our in person SAS Blowout on Oct 18 in Cambridge, MA. Registration opens in September.
Astounding
PROC Star
It might be feasible to store the information as a permanent SAS data set instead of macro variables. In the simplest scenario you would need two variables:

NAME = name of a shared macro variable
VALUE = value of that variable

Then each user could easily reconstruct all the macro variables:

data _null_;
set perm.maclist;
call symputx(name, value) ;
run;

Two issues to consider:

Do users need to update the list of macro variables? This will create contention for the data set.

What length should be used for VALUE? It needs to be long enough to hold your longest macro variable.

Note that it would be possible to make the DATA _NULL_ step part of an auto autoexec file.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 403 views
  • 1 like
  • 3 in conversation