Desktop productivity for business analysts and programmers

Specifying Option Values before the generated stpbegin macro call

Reply
Regular Contributor
Posts: 150

Specifying Option Values before the generated stpbegin macro call

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.
SAS Super FREQ
Posts: 8,818

Re: Specifying Option Values before the generated stpbegin macro call

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
N/A
Posts: 0

Re: Specifying Option Values before the generated stpbegin macro call

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.
Regular Contributor
Posts: 150

Re: Specifying Option Values before the generated stpbegin macro call

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 (Smiley Wink. So I was able to change the code so that message is not generated.

However, macros should not require semicolons.
SAS Super FREQ
Posts: 8,818

Re: Specifying Option Values before the generated stpbegin macro call

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
Regular Contributor
Posts: 150

Re: Specifying Option Values before the generated stpbegin macro call

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.
SAS Super FREQ
Posts: 8,818

Re: Specifying Option Values before the generated stpbegin macro call

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
Ask a Question
Discussion stats
  • 6 replies
  • 137 views
  • 0 likes
  • 3 in conversation