Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mm_spkexport.sas File Reference

Creates an batch spk export command. More...

Go to the source code of this file.

Detailed Description

Creates a script that will export everything in a metadata folder to a specified location. If you have XCMD enabled, then you can use mmx_spkexport (which performs the actual export)

Note - the batch tools require a username and password. For security, these are expected to have been provided in a protected directory.

Usage:

%* import the macros (or make them available some other way);
filename mc url
  "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc;

%* create sample text file as input to the macro;
filename tmp temp;
data _null_;
  file tmp;
  put '%let mmxuser="sasdemo";';
  put '%let mmxpass="Mars321";';
run;

filename myref "%sysfunc(pathname(work))/mmxexport.sh"
  permission='A::u::rwx,A::g::r-x,A::o::---';
%mm_spkexport(metaloc=%str(/my/meta/loc)
    ,outref=myref
    ,secureref=tmp
    ,cmdoutloc=%str(/tmp)
)

Alternatively, call without inputs to create a function style output

filename myref "/tmp/mmscript.sh"
  permission='A::u::rwx,A::g::r-x,A::o::---';
%mm_spkexport(metaloc=%str(/my/meta/loc)
    outref=myref
    ,cmdoutloc=%str(/tmp)
    ,cmdoutname=mmx
)

You can then navigate and execute as follows:

cd /tmp
./mmscript.sh "myuser" "mypass"

SAS Macros

Parameters
[in]metaloc=the metadata folder to export
[in]secureref=fileref containing the username / password (should point to a file in a secure location). Leave blank to substitute $bash vars.
[in]excludevars=(0) A space seperated list of macro variable names, each of which contains a value that should be used to filter the output objects.
[out]outref=fileref to which to write the command
[out]cmdoutloc=(sysfunc(pathname(work))) The directory to which the command will write the SPK
[out]cmdoutname=(mmxport) The name of the spk / log files to create (will be identical just with .spk or .log extension)
Version
9.4
Author
Allan Bowe

Definition in file mm_spkexport.sas.