Architecting, installing and maintaining your SAS environment

Automating SAS Package Exports

Reply
Occasional Contributor
Posts: 12

Automating SAS Package Exports

I am currently looking for a way to automate the capturing of a SAS Package (at the SASFolders level), to perform regularly schedule backups/exports of the SAS VA materials that we have generated. I have done little research that points to using the SAS Batch Export & Import tool...is this where I am needing to start? Does anyone have any experience using this?

 

Regards,

Contributor
Posts: 53

Re: Automating SAS Package Exports

[ Edited ]
Posted in reply to egwilliamson

Yes, the batch export tools are what you need.  So long as you have X command enabled, you can export from SAS.  I previously made a stackoverflow post for exporting items individually (rather than at folder level), I've just quickly modified it to suit your needs..  Please note - this code is untested!

 

%let connx_string= -host YOURHOST -port 8561 -user YOURUSER -password YOURPASS;
options noquotelenmax;
/* get location of BatchExport metadata tool */ /*http://support.sas.com/documentation/cdl/en/bisag/64088 /HTML/default/viewer.htm#a003261084.htm*/ data _null_; h="%sysget(SASROOT)"; h2=substr(h,1,index(h,"SASFoundation")-2); call symputx("platform_object_path" ,cats(h2,"/SASPlatformObjectFramework/&sysver")); run; %put Batch tool located at: &platform_object_path; data _null_; infile "C: & cd ""&platform_object_path"" %trim( ) & ExportPackage &connx_string %trim( )-package ""/location/to/save/your.spk"" %trim( )-objects ""/your/sas/meta/path"" %trim( )-log ""/location/to/save/your.log"" 2>&1" pipe lrecl=1000; input; list; run;

 

Here is the link to the documentation.  Be aware that if you are on windows, and you are going to use this approach to build a very long command, there is a weird bug (not a SAS bug) that will somehow remove one of your characters!  See here.

/Allan
Think you know SAS? Take the sasensei challenge..
Frequent Contributor
Posts: 83

Re: Automating SAS Package Exports

Posted in reply to egwilliamson
Hi @egwilliamson,

You can use the Batch Import tool from command line of server as well. Just that it can be very long depending upon the Number of objects you have for export.

You can find more details about the syntax and procedure on the SAS Intelligence Platform system admin guide chapter "Using the Batch Export and Import tools".

Hope this helps.
Ask a Question
Discussion stats
  • 2 replies
  • 149 views
  • 3 likes
  • 3 in conversation