Reputation: 161
I am using oscmd command to run some operating system operation from sas, but want to make it generic by passing the varible in oscmd command.
I am using below code:
%global name =skstar; filename oscmd pipe "python test.py --inputvar=&name.";
The value of variable'name'is not replace in command.
EDIT: the above part is working now , its just a quotation mistake. but wanted to know the way to abort the oscmd cli command ,if in case parameter value passed is wrong
Upvotes: 0
Views: 348
Reputation: 141
maybe your datastep is wrong but you not write there. It's work fine:
%let name=test words;
filename oscmd pipe "echo &name.";
data _null_;
infile oscmd;
input;
put _infile_;
run;
/*log:
NOTE: The infile OSCMD is:
Unnamed Pipe Access Device,
PROCESS=echo test words,RECFM=V,LRECL=32767
test words
NOTE: 1 record was read from the infile OSCMD.
The minimum record length was 10.
The maximum record length was 10.
NOTE: DATA statement used (Total process time):
real time 0.18 seconds
cpu time 0.03 seconds
*/
Upvotes: 1