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
SAS Super FREQ
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
SAS Super FREQ
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
SAS Super FREQ
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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