Code wizards make the magic happen

7

Wizard Harry Potter makes magic just waving his wand around and shouting out spells. Using SAS Enterprise Guide (and you are welcome to shout out your own commands too) you can create some magic, allowing the Stored Process Wizard to code for you. On Step 2, the "Include code for" button allows you to choose whether the spell will include stored process macros, global macro variables, and references to libnames. In doing so, the key is to remember in magic and wizardry there can be a man behind the curtain. You will not see this when editing the stored process from Enterprise Guide, but the actual .sas file on the server contains all of this code.

In the below screenshot is the original code (squared off in red) with the three default additions created by the SAS Enterprise Guide Stored Process Wizard.

  1. *ProcessBody
    This was a required element for the SAS Workspace Server in 9.2 and prior versions. This alerted the server on where the code began.
  2. %STPBEGIN and %STPEND Statements
    Provides all of the header/footer information to enable output to ODS locations so that you don't have to code it yourself. There are instances where I recommend (and you are required to) not select this option, such as when generating custom HTML layouts.
  3. ExtendValidMemName
    Enables the use of an extended validmemname for 9.3+ versions. This will appear for all stored processes created from SAS Enterprise Guide 5.1, no matter what is selected in the "Include code for" button.


When I attempt to edit the code using the Stored Process Manager from SAS Enterprise Guide, I only see the two lines of code. In the majority of cases, this will work out just fine. But if you are trying to code something custom, just stay aware of what magic is happening around you!

Share

About Author

Angela Hall

Senior Technical Architect

Angela offers tips on using the SAS Business Intelligence solutions. She manages a team of SAS Fraud Framework implementers within the SAS Solutions On-Demand organization. Angela also has co-written two books, 'Building BI using SAS, Content Development Examples' & 'The 50 Keys to Learning SAS Stored Processes'.

Related Posts

7 Comments

  1. What is the stored process defaulted to in EG 7.1 9.4 M2. I am having some issues. It seems like it is now defaulting to V7 instead of Any. Thoughts?

  2. Ηi there, Ӏ wish for to subsсribe foг this weblog to get lateѕt updates, so where cаn i do it please help οut.

  3. Pingback: Reading to beat the heat - Key Happenings at support.sas

  4. Quentin McMullen on

    Thanks Angela,
    I think I understand. So EG has these options set (in the background), so turning these options on in the stored process means if someone has working code in EG, that code will still work if they convert it to a stored process. Of course for those of us who have working code in base SAS (where validvarname=v7 is the default I think) it can break in the stored process (with validvarname=any the default). I think I'll put in a sas ballot suggestion to make this option optional, since you can control most of the other stuff with the "include code for" button. Thanks for the explanation, and for the great blog!
    --Q.

  5. Quentin McMullen on

    Thanks Angela,
    It seems odd to me that validvarname=any and validmemname=extend cannot be omitted by the "include code for" button. Maybe it's just that change is hard, but I tend to like validvarname=v7 and validmemname=compatible, even when it forces SAS to translate foreign names into SASsy names when reading from an external data sources. Seems like now my options are to add an options statement to every stored process code, or to manually revise the stored process source .sas file to remove these lines.
    Am I missing something? Are these options really so critical that the wizard shouldn't make it easier for them to be omitted?
    Thanks,
    -Q.

    • Angela Hall

      Hi Quentin,
      I discussed with our SAS Technical Support Enterprise Guide GURU. Since Enterprise Guide tasks make use of these options to automatically generate SAS code, we needed to ensure that process flows converted to SAS Stored Processes will continue to work. Therefore the validmemname=extend for 9.3/EG 5.1 was added. (Also, note that the validvarname=any has always been automatically added to EG created Stored Processes.)

Back to Top