BookmarkSubscribeRSS Feed
DonH
Lapis Lazuli | Level 10
I have written a stored process that my user/client wants to be able to edit in EG 4.2 (I wrote it using SAS on the server). The stored process generates a landscape PDF report. I have specified _odsDest as a hidden parameter with a value of PDF to create a PDF report. I also added:

options orientation=landscape;

before the stpbegin call to create a landscape report. However when the stored process is edited in EG it inserts an extra stpbegin above that code, thus causing the report to be generated as portrait.

How can allow him to edit it in EG, yet preserve the landscape option. I did not see any options/settings in EG that would allow me to do that.
6 REPLIES 6
Cynthia_sas
Diamond | Level 26
Hi, Don:
I don't have a current install to test, but someplace on the SP setup screens, there was a way to check whether to include code for the macros -- in EG 4.1, it was 3 little check boxes at the bottom of one step. I'm not sure whether that still exists in EG 4.2. I remember the place that you could check was on the step where the code was showing.

cynthia
deleted_user
Not applicable
On the second page of the stored process wizard there is a "Include code for" drop down button. From this you can uncheck the "Stored process macros" which will suppress the generation of the %STPBEGIN/%STPEND macros. If you uncheck this you will have to manually insert the %STPBEGIN/%STPEND macros, but you also have full control over where to place them.
DonH
Lapis Lazuli | Level 10
Thanks Greg and Cynthia. Worked just as you explained.

I did notice however that EG was issuing a warning that the option to generate stpbegin/stpend was turned off AND they were not inclulded in the code. But they were included in the code. I finally determined that the problem appears to be that EG is looking for the macro calls with a semicolon (;). So I was able to change the code so that message is not generated.

However, macros should not require semicolons.
Cynthia_sas
Diamond | Level 26
Hi, Don...that little extra semicolon in a macro call dates back to SAS/IntrNet days. We used to have to teach students to explicitly put the ';' when they used macro programs in Application Dispatcher code. It was something about how a token needed to be provided -- I've forgotten exactly why that was. But I noticed that it carried over to stored processes. My guess is that's because the stored process server is very like the old Application Dispatcher APPSRV. Just a guess.

(I feel your pain.)

cynthia
DonH
Lapis Lazuli | Level 10
The issue is not really IntrNet as I think the problem is a very old one. I actually discovered it (and reported it) back in the early 80s. If a macro can have parameters, and no parameter values are specified (i.e., there are no parens), and the macro call is the last token in the program, the SAS wordscanner issues an error for Unexpected End of File since it is looking for parens.

The correct (IMO) way to handle this is to call the macro as:

%stpend()

instead of putting a semicolon at the end. As long as the stpend macro is not the last token, there is no error.
Cynthia_sas
Diamond | Level 26
Sorry, I did not mean to imply that the issue came with IntrNet.

In fact, we've always taught the use of () in our macro class for the reason you state.

However, in Education classes, we first explicitly showed using a semi-colon as a closing token when we wrote the first SAS/IntrNet class. And, the stored process doc explicitly mentions the need to use a closing ; for %STPBEGIN/%STPEND
here in the doc:
http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/stpmacro.html

where it says:
"Note: You must include a semicolon at the end of the %STPBEGIN and %STPEND macro calls."

So even though I agree with your understanding of how macro invocation works/should work, the closing semicolon is documented explicitly for %STPBEGIN/%STPEND.

cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1816 views
  • 0 likes
  • 3 in conversation