If I create a Stored Proc using Enterprise Guide then EG adds in the 'special' SP code for me e.g. the %stpbegin statement.
Say I want to override any user choice of ODS style, the documentation provides an example whereby if I code in the line "%let _odsstyle = sasweb;" then the SP uses this value. I tried this but it wont't work and I think the reason is because in the SP code the %stpbegin is placed before my %let statement by EG. How can I edit the code within EG and ensure the correct statement order? Is there a way of preventing EG from generating the SP header and footer code so I can type it in myself?
You don't have to prevent EG from generating the STPBegin/End since you should be able to edit the code quite esily. When you create a Stored Process, the resulting code in generated and saved in the location that you specify in the "Source File Path on Execution Server" - if you find your generated code, you should be able to pull it into EG and edit it however you need to. You can then save it and rerun the stored process and it should pick up any changes. We played around with the same thing (overriding the ODS style) and were able to edit the Stored Process Code. Hope that helps (and makes sense).
The preferred way to control the behavior of the STPBEGIN/STPEND macros is by use of input parameters, not by hard coding values with a %LET statement.
For example, if you want to control the ODS style that is used, register a parameter named _ODSSTYLE and give it a default value. At run-time, users will be able to specify the value they want to use. If you don't want the user to change the value at run-time, clear the "Modifiable" and "Visible" check boxes for this parameter.