Published on :
Administration CREATION_INTERNE

System write macro via XCMD

This code is also available in: Deutsch Español Français
Awaiting validation
Attention : This code requires administrator privileges.
This macro 'AHGcmdNo' uses the SAS© 'x' command to execute a shell command (echo). It writes the value of the 'num' parameter to a text file 'cmdNo.txt' located in the directory pointed to by the 'localtemp' macro variable. The use of the 'x' command requires system privileges and that the XCMD option be enabled (often restricted in a secure Viya environment).
Data Analysis

Type : CREATION_INTERNE


The code generates an external file from a macro parameter, without reading a SAS table.

1 Code Block
MACRO Data
Explanation :
Definition of the macro that invokes the operating system to create/overwrite the cmdNo.txt file with the provided value.
Copied!
1%macro AHGcmdNo(num);
2x "echo &num >&localtemp\cmdNo.txt";
3%mend;
4 
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.