Macros for SAS Application Developers
No Matches File Reference

Create a type 1 Stored Process (9.2 compatible) More...

Go to the source code of this file.

Detailed Description

This macro creates a Type 1 stored process, and also the necessary PromptGroup / File / TextStore objects. It requires the location (or uri) for the App Server / Directory / Folder (Tree) objects. To upgrade this macro to work with type 2 (which can embed SAS code and is compabitible with SAS from 9.3 onwards) then the UsageVersion should change to 2000000 and the TextStore object updated. The ComputeServer reference will also be to ServerContext rather than LogicalServer.

This macro is idempotent - if you run it twice, it will only create an STP once.

Usage (type 1 STP):

  ,tree=/User Folders/sasdemo

If you wish to remove the new STP you can do so by running:

data _null_;
  set work.uris;
  rc1 = METADATA_DELOBJ(texturi);
  rc2 = METADATA_DELOBJ(prompturi);
  rc3 = METADATA_DELOBJ(fileuri);
  rc4 = METADATA_DELOBJ(stpuri);
  putlog (_all_)(=);

Usage (type 2 STP):

  ,tree=/User Folders/sasdemo
[in]stpname=(SASjs Default STP) Stored Process name. Avoid spaces - testing has shown that the check to avoid creating multiple STPs in the same folder with the same name does not work when the name contains spaces.
[in]stpdesc=Stored Process description (optional)
[in]filename=the name of the .sas program to run
[in]directory=(SASEnvironment/sascode) The directory uri or the actual path to the sas program (no trailing slash). If more than uri is found with that path, then the first one will be used.
[in]tree=The metadata folder uri, or the metadata path, in which to create the STP.
[in]server=(SASApp) The server which will run the STP. Server name or uri is fine.
[out]outds=(work.mm_createstp) The two level name of the output dataset. Will contain all the meta uris.
[in]mDebug=set to 1 to show debug messages in the log
[in]stptype=Default is 1 (STP code saved on filesystem). Set to 2 if source code is to be saved in metadata (9.3 and above feature).
[in]minify=set to YES to strip comments / blank lines etc
[in]frefin=(mm_in) fileref to use (enables change if there is a conflict). The filerefs are left open, to enable inspection after running the macro (or importing into an xmlmap if needed).
[out]frefout=(mm_out) fileref to use (enables change if there is a conflict)
[in]repo=ServerContext is tied to a repo, if you are not using the foundation repo then select a different one here
[in]LogicalServerType=(Sps) Server Type to use. Valid options:
  • Any - Uses the default server.
  • Sps - Stored Process Server, best choice for web app development. Runs under a system account identity (eg sassrv).
  • Wks - Workspace Server. Runs under the end user identity.
outds dataset containing the following columns:
  • stpuri
  • prompturi
  • fileuri
  • texturi

SAS Macros

Related Macros

Allan Bowe

Definition in file