Stored process code can exist within the metadata itself for version 9.3 (the benefits of which I discussed earlier). But for all other versions (and as a option in version 9.3) the SAS code is stored as a .sas file within the server's file system (or mapped folder/drive structure). When editing stored process code directly, you need to know where the stored process .sas file resides.
Here are a few places to find that .sas file location. Do you have any other ways?
1. Through the SAS Management Console properties screen, select the Execution tab.
2. Using PROC STP (SAS 9.3)
options metaserver = 'machine' metaport = 8561 metauser = 'XXXXXXXXXX' metapass = XXXXXXXXXX; PROC STP PROGRAM='/Projects/Book Examples/12_d_AMOParetoEdits'; list group=execution; run;
The output then provides:
NOTE: PROC_STP: ====== Stored Process: /Projects/Book Examples/12_d_AMOParetoEdits ======
NOTE: PROC_STP: ====== Metadata Listing for /Projects/Book Examples/12_d_AMOParetoEdits ======
NOTE: Logical Server: SASApp - Logical Stored Process Server
NOTE: Source Code Repository: C:\SAS\Stp Book
NOTE: Source File: Example_12d_AddInParetoEdits.sas
NOTE: Result Type: Packages No
NOTE: Streaming Yes
NOTE: PROC_STP: ====== End Metadata Listing for /Projects/Book Examples/12_d_AMOParetoEdits ======
NOTE: PROC_STP: ====== Stored Process: /Projects/Book Examples/12_d_AMOParetoEdits Return Status
= 0 ======
NOTE: PROCEDURE STP used (Total process time):
real time 0.63 seconds
cpu time 0.04 seconds
3. By running a metadata call
In the following example, I have a sas program that will pull out a full list of all the stored processes registered in the metadata, each corresponding .sas file and where in the server these physical files reside.
/*insert an options statement here to connect to your metadata server/port.*/ data new(keep=dirname stpname stpcode); label dirname="Directory Name"; label stpname="Stored Process Name"; label stpcode=".sas File Name"; length uri name dirname stpuri stpcode stpassn stpname $256; uri=""; name=""; dirname=""; stpuri=""; stpcode=""; stpassn=""; stpname=""; n=1; nobj=1; do while(nobj >= 0); nobj=metadata_getnobj("omsobj:Directory?@Id contains '.'",n,uri); put nobj; if (nobj < 0) then leave; rc=metadata_getattr(uri,"Name",Name); rc=metadata_getattr(uri,"DirectoryName",DirName); if Name = "SP Source Directory" then do; rc1=1; x=1; do while(rc1>0); rc1=metadata_getnasn(uri, "Files", x, stpuri); rc2=metadata_getattr(stpuri, "FileName", stpcode); rc3=metadata_getnasn(stpuri, "AssociatedTransformation", 1, stpassn); rc4=metadata_getattr(stpassn, "Name", stpname); x+1; output; end; end; n+1; end; run; title 'All Stored Process Locations'; proc print label noobs; run;
Included below is a screenshot of the resulting report.
Pingback: Using METABROWSE to locate and code programs to retrieve metadata
How about something like -
Thanks D! When adding _action=data in the URL of the SAS Stored Process Web Application for a specific stored process, you can retrieve this same information. Included in the documentation is an example of the "Stored Process Summary Page".