An Idea Exchange for SAS software and services

by Super User
on ‎03-22-2016 09:54 AM

It may not be obvious, but I think you already have this ability.  The dictionary table (dictionary.macros, which should have the same structure as sashelp.vmacro) contains a variable named SCOPE.  It takes on values of AUTOMATIC (for system-generated macro variables) and either GLOBAL or LOCAL (for user-generated macro variables).

by Frequent Contributor
‎03-22-2016 09:58 AM - edited ‎03-22-2016 10:08 AM

@Astounding   Thank you for your Comment. Actually i did  look into  it before posting this Idea.  But  there are few  GLOBAL  Macro variables which  are  system defined and cannot  be deleted  .My aim is  to   identify  ONLY  the  "User Defined" Macro variables.Also  i  do not see a value  of LOCAL   for "Scope"  in the  VMACRO  view  when i create a Macro variable. It is actually captured under  GLOBAL Scope.

by Super User
on ‎03-22-2016 10:09 AM

The only ones that I've seen like that are the ones created by running PROC SQL.  It might make sense for those to have a unique value for SCOPE.  Are there any others that you have encountered?

by Frequent Contributor
on ‎03-22-2016 10:26 AM

Yes .  when  i run SAS Code on  Clients  such  as SAS EG  i get additional  GLOBAL  macro variables  as shown below.



by Valued Guide
on ‎03-28-2016 03:20 AM

The solition of an addtional column in sashelp.vmacro won't help much.
What really is needed is some addtional core attribute wiht a macro indicating owner/goal.  That is some metadata architecture.

A naming covnention could help is some standardisation but is very hard to be agreed and followed by everyone (MXG?)

by Occasional Learner m-macghreagoir
on ‎03-30-2016 04:09 PM
If you are using a version of SAS that supports %put _user_ here is a do-it-yourself way to get a list of user-defined macro vars: 1. redirect the log to a temporary file (or catalog entry in work), 2. run %put _user_ ; 3. restore log to default location; 4. use a data step to parse the temporary file. The output of %put _user_ not only lists user-defined variables but identifies whether they are global or which macro scope they belong to if they are local. Should be easy to make a standard macro to do this.
Idea Statuses
Top Liked Authors