BookmarkSubscribeRSS Feed
9 REPLIES 9
srinijareddy
Calcite | Level 5
Okay. But I want to know that can I find any basic explanations on how macros will be used in different environments
Kurt_Bremser
Super User

@srinijareddy wrote:
Okay. But I want to know that can I find any basic explanations on how macros will be used in different environments

Just in case it has escaped you:

Macro programming is not dependent on the user interface or the runmode.

DavidHD
SAS Employee
While I generally agree I would add to this, that the run mode can have an influence if different autoexec are used because of e.g. different server context (SAS App vs SAS DI as a concrete example).
Kurt_Bremser
Super User

@DavidHD wrote:
While I generally agree I would add to this, that the run mode can have an influence if different autoexec are used because of e.g. different server context (SAS App vs SAS DI as a concrete example).

You could have different macro parameters/variables, yes, but the macro language will be the same.

And changes between environments would be site-specific and documented there, but not in any publicly available resource.

ballardw
Super User

@srinijareddy wrote:
Okay. But I want to know that can I find any basic explanations on how macros will be used in different environments

The SAS macro language writes code statements.

There will not be any difference in behavior for the generated statements by "environment" than if you wrote the code and ran it.

JackHamilton
Lapis Lazuli | Level 10

>> The SAS macro language writes code statements. <<

 

That's a narrow view of what the macro facility can do.  It can also prompt the user for input, read to and write from external files, obtain information about the programming environment, and create librefs and filerefs, all without generating any non-macro code.

ballardw
Super User

@JackHamilton wrote:

>> The SAS macro language writes code statements. <<

 

That's a narrow view of what the macro facility can do.  It can also prompt the user for input, read to and write from external files, obtain information about the programming environment, and create librefs and filerefs, all without generating any non-macro code.


Yes you can write a lot of Fopen, and related read and write stuff. ALL of it uses datastep functions with %sysfunc, which statement was not available when I first delved into learning macro code with SAS 5.

So I would not consider that a pure macro facility. In fact in many ways obfuscating stuff that may be better done with a data step.

 

If by "prompt for use input" by using the %window code, same thing basically as Window from the data step. If the later EG "prompt" that is not the quite the same a using pure macro code to get such in general.

 

I pity anyone going down the road of writing 50 page reports using %sysfunc(Fput,id,%somemacrovalue) statements.

Kurt_Bremser
Super User

Prompting for user input from code is largely obsolete, as defined user prompts for EG nodes and stored processes have taken over that functionality. User inputs from code can't be done in a client/server environment.

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 9 replies
  • 1109 views
  • 2 likes
  • 5 in conversation