Hello,
I create a batch file to run winsteps in sas and it doesn't work. I can run my control file directly in winsteps and create output. But when I use SAS command X to run winsteps. It did not provide output file. Here is my code. Could you please check whether my code has problem. Sorry I cannot provide the data.
%macro TOT( ankey=,maxitem=, run=);
DATA _NULL_;
set itemid end=eof;
FILE "&dir.\&run._control.txt";
IF _N_ = 1 THEN DO;
PUT
'&INST'/
"TITLE= run &run."/ /* Change title as needed */
"ITEM1= 11"/
"NI= &maxitem. "/
"NAME1= 1"/
"NAMLEN= 10"/
"XWIDE= 1"/
"CODES= ABCD "/
"TOTALSCORE= Yes"/
"KEY1= &ankey."/
"PVALUE= Y"/
"PTBIS= PTMA"/
/
"ITLEN= 13"/
"IWEIGHT= '&dir.\&run._weight.txt'"/
"DATA= '&dir.\data.txt' "/
"IDFILE= '&dir.\&run._delete.txt' "/
"IAFILE= '&dir.\&run._anchor.txt' "/
"PFILE= '&dir.\&run._persons.txt' "/
"DISFILE= '&dir.\&run._optons.txt' "/
"IFILE= '&dir.\&run._items.txt'"/
/
'*'/
/
"TFILE=* "/
"1.2 "/
"3.1"/
"3.2"/
"14.1"/
"14.3"/
'30'/
"*"/
'&END';
END;
put itemid ;
IF EOF THEN PUT "END NAMES";
RUN;
data _null_;/*change directory and output file name */
file "&dir.\batch.txt";
put "&wspath. BATCH=YES &dir.\&run._CONTROL.TXT &dir.\&run._OUTPUT.TXT";
*put "exit";
run;
/*options xmin noxwait;*/
x "start &dir.\batch.txt";
%mend;
%tot(ankey=&akey.,maxitem=&nitem.,run=1);
Thanks a lot!
If you want to know what happens with an external command, run it like this:
filename oscmd pipe "your_command 2>&1";
data _null_;
infile oscmd;
input;
put _infile_;
run;
This will reveal all system output in the SAS log.
KurtBremser, thank you for the reply. I found the problem which because my DOS system direction is wrong. I adjusted my code and it worked. I appreciate your help.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.