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

Creates a file in SAS Drive using the API method. More...

Go to the source code of this file.

Detailed Description

Creates a file in SAS Drive using the API interface. If the parent folder does not exist, it is created. The API approach is more flexible than using the filesrvc engine of the filename statement, as it provides more options.

SAS docs: https://developer.sas.com/rest-apis/files/createNewFile

Usage:

filename myfile temp;
data _null_;
  file myfile;
  put 'something';
run;
%mv_createfile(path=/Public/temp,name=newfile.txt,inref=myfile)
Parameters
[in]path=The parent (SAS Drive) folder in which to create the file
[in]name=The name of the file to be created
[in]inref=The fileref pointing to the file to be uploaded
[in]intype=(BINARY) The type of the input data. Valid values:
  • BINARY File is copied byte for byte using the mp_binarycopy.sas macro.
  • BASE64 File will be first decoded using the mp_base64.sas macro, then loaded byte by byte to SAS Drive.
[in]contentdisp=(attchment) Content Disposition. Example values:
  • inline
  • attachment
[in]ctype=(0) The actual MIME type of the file (if blank will be determined based on file extension))
[in]access_token_var=The global macro variable to contain the access token, if using authorization_code grant type.
[in]grant_type=(sas_services) Valid values are:
  • password
  • authorization_code
  • sas_services
[out]outds=(null) Output dataset with the uri of the new file
[in]mdebug=(0) Set to 1 to enable DEBUG messages

SAS Macros

Related Macros

Definition in file mv_createfile.sas.