/**
@file
@brief Create a type 1 Stored Process (9.2 compatible)
@details 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):
%mm_createstp(stpname=MyNewSTP
,filename=mySpecialProgram.sas
,directory=SASEnvironment/SASCode/STPs
,tree=/User Folders/sasdemo
,outds=work.uris)
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_)(=);
run;
Usage (type 2 STP):
%mm_createstp(stpname=MyNewType2STP
,filename=mySpecialProgram.sas
,directory=SASEnvironment/SASCode/STPs
,tree=/User Folders/sasdemo
,Server=SASApp
,stptype=2)
@param stpname= 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.
@param stpdesc= Stored Process description (optional)
@param filename= the name of the .sas program to run
@param directory= 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.
@param tree= The metadata folder uri, or the metadata path, in which to
create the STP.
@param server= The server which will run the STP. Server name or uri is fine.
@param outds= The two level name of the output dataset. Will contain all the
meta uris. Defaults to work.mm_createstp.
@param mDebug= set to 1 to show debug messages in the log
@param 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).
@param minify= set to YES to strip comments / blank lines etc
@param frefin= 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).
@param frefout= fileref to use (enables change if there is a conflict)
@param repo= ServerContext is tied to a repo, if you are not using the
foundation repo then select a different one here
@returns outds dataset containing the following columns:
- stpuri
- prompturi
- fileuri
- texturi