DATA Step, Macro, Functions and more

why using using batch file to run winsteps in SAS doesn't work?

Reply
Contributor
Posts: 62

why using using batch file to run winsteps in SAS doesn't work?

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!

Super User
Posts: 7,854

Re: why using using batch file to run winsteps in SAS doesn't work?

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 62

Re: why using using batch file to run winsteps in SAS doesn't work?

Posted in reply to KurtBremser

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. 

Ask a Question
Discussion stats
  • 2 replies
  • 91 views
  • 0 likes
  • 2 in conversation