DATA Step, Macro, Functions and more

%global-statement wirth dynamic varaible-names

Reply
N/A
Posts: 0

%global-statement wirth dynamic varaible-names

Hi. Is there any way to declare global macro-variables with dynamic varaible-names?
Or rather; i tried to write a %global statement like

%global &mvar

in a do-loop. The macro-variable mvar contains the actual variable-name for the global statement; but i woudln't be solved.
If i write %global "&mvar" it would be solved as %global "mvarcontent", but %global didn't work with qutotet variable-names. Message was edited by: idefix
N/A
Posts: 0

Re: %global-statement wirth dynamic varaible-names

why bother?
N/A
Posts: 0

Re: %global-statement wirth dynamic varaible-names

I wrote a macro including a data-step which creates a lot of macro-variables with call symput function.
Later i need that macro-variables in another macro; but they are not available (local in the other macro).
N/A
Posts: 0

Re: %global-statement wirth dynamic varaible-names

then use CALL SYMPUTX() with the G parameter

or create them local to the environment under which they are filled and used alternatives to Global macro variables exist


Message was edited by: Peter_c
N/A
Posts: 0

Re: %global-statement wirth dynamic varaible-names

SYMPUTX with the G parameter also creates non global variables within a macro.

But ... it think they are not really local.

If i put them with %put _users_ into the log i get a list like this:

TEST_MACRO mvar_1
GLOBAL _SASSPLEVEL SAS 9.1.3 Service Pack 4
GLOBAL _EGUSERNAME 
GLOBAL _EGSERVERNAME SASReporting

The variable-type is the macro-name, not global or local.
Might that be the problem?
Ask a Question
Discussion stats
  • 4 replies
  • 138 views
  • 0 likes
  • 1 in conversation