DATA Step, Macro, Functions and more

SAS Program does not start when started via bat file

Accepted Solution Solved
Reply
Contributor
Posts: 29
Accepted Solution

SAS Program does not start when started via bat file

Hello all,

after a while I am writing again because I have a very strange problem:

 

I have a program that is started from a scheduler via a batch file:

 

The batch file contains the following line:

 

start "Titel" "C:\Program Files\SAS93\SASFoundation\9.3\sas.exe" "C:\Users\adm\Desktop\LParcheck.sas"

 

This solution was running for many many years, but after a few weeks the start of the sas program via batch file does not work any more.

BUT when I open my SAS Base and run the program from there everything is running fine.

Only when I start the sas program via the above mention bat file I receive an error.

 

This is the error that is written in the log after starting it via bat file (please see excerpt from log file):

 


388        quit;
389       
390        %macro mail;
391        proc freq data=work.lparliste noprint;
392        tables newdate /out=work.dat;
393        run;
394       
395        data work.anzahl;
396        set work.dat;
397        keep Datum Anzahl;
398        Datum=newdate;
399        Anzahl=count;
400        run;
401       
402        ods html close;
403        filename temp email to="X@tde"
404           CC="CC@Xde"
405                    from="X@.de"
406                    subject="Qualitätsmanagement Unix-Lpars Std-Ebene"
407                    type="text/html";
408          
409           ods html body=temp rs=none;
410       
411           proc report nowindows data=work.delta headline;
412             Title 'Lpars, zu denen keine Daten gesammelt werden können:';
413          label lpar= 'Lpar-Name:';
414           run;
415       
416       
417           ods html close;
418       
419        %mend mail;
WARNING: The quoted string currently being processed has become more than 262 characters long. 
         You might have unbalanced quotation marks.
420       
421        %macro checkit;
422        /* Anzahl member bestimmen;*/
423        %LET anzmem = 0;
424        %PUT &anzmem;
425        DATA _NULL_;
426           SET POINT=X work.delta nobs=anzmem;
427           CALL SYMPUT('anzmem',anzmem);
428           STOP;
429        RUN;
430       
431        %put &anzmem;
432        %if &anzmem > 0 %then %mail;
433        run;
434        %mend checkit;
WARNING: The quoted string currently being processed has become more than 262 characters long. 
         You might have unbalanced quotation marks.
435       
436        %checkit;
22                                        Das SAS System           14:00 Wednesday, April 20, 2016

0
0

            _________________________________________________________________________________
            22

ERROR 22-322: Syntax error, expecting one of the following: ein Name,
              eine Zeichenkette in Hochkommata, eine numerische Konstante,
              eine Datetime-Konstante, ein fehlender Wert, (, +, -, BTRIM, CALCULATED, CASE,
              INPUT, PUT, SUBSTRING, TRANSLATE, USER. 


            _________________________________________________________________________________
            200

ERROR 200-322: The symbol is not recognized and will be ignored.

NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROZEDUR SQL used (Total process time):
      real time           0.11 seconds
      cpu time            0.01 seconds
     

ERROR: Errors printed on page 22.

NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: Das SAS System used:
      real time           0.78 seconds
      cpu time            0.38 seconds

 

Does anybody have an idea what could be the reason for this problem?

I am totally helpless after searching Google for many hours.

 

Thanks in advance and best regards

Christobal

 


Accepted Solutions
Solution
‎04-21-2016 12:17 AM
Trusted Advisor
Posts: 1,115

Re: SAS Program does not start when started via bat file

Hello @Christobal,

 

Indeed, as @RW9 has pointed out, the actual problem in the code must be before the section shown in your post. More precisely, I would look into the PROC SQL step which is maybe ending with the QUIT statement shown in the first line of the log excerpt, because this should be the step where the error occurred, according to the first error message and the subsequent notes.

 

However, as it seems to be the way the program is submitted, I would first modify the batch file, e.g., like this:

"C:\Program Files\SAS93\SASFoundation\9.3\sas.exe" -lrecl max -sysin C:\Users\adm\Desktop\LParcheck.sas

With the SYSIN system option the program will run in batch mode (not sure if this is appropriate for your specific program). The LRECL system option should help to prevent truncation of long lines of code in your program (cf. SAS Usage Notes 5953 and 15883). It is possible that a closing quotation mark was lost due to code truncation, hence the warnings in your log.

View solution in original post


All Replies
Super User
Super User
Posts: 7,401

Re: SAS Program does not start when started via bat file

This is going to be very difficult for anyone here to debug for you.  Something has changed somewhere - be it a different version of software (SAS, email, OS - or patches for OS) or in paramters, or in fact anything else.  The log is telling you that at some point in the code you have inbalanced quotes, which means its treats everything from the quote as text.  You need to look back at the log prior to where it stops doing anything, i.e. somewhere in the log there will be datastep or procs which run, then the step after that will not do anything e.g.;

100  data want; set sashelp.class; run;

  NOTE: Datstep used...

 

110 data went_wrong; set" sashelp....       <- here is where the problem is.

120 data abc;..

Warning: The current...

 

So you need to go back and run it step by step, see what feeds in, find wht has changed or what was not accounted for.  Not sure why you need to put all that code in macros either.

Solution
‎04-21-2016 12:17 AM
Trusted Advisor
Posts: 1,115

Re: SAS Program does not start when started via bat file

Hello @Christobal,

 

Indeed, as @RW9 has pointed out, the actual problem in the code must be before the section shown in your post. More precisely, I would look into the PROC SQL step which is maybe ending with the QUIT statement shown in the first line of the log excerpt, because this should be the step where the error occurred, according to the first error message and the subsequent notes.

 

However, as it seems to be the way the program is submitted, I would first modify the batch file, e.g., like this:

"C:\Program Files\SAS93\SASFoundation\9.3\sas.exe" -lrecl max -sysin C:\Users\adm\Desktop\LParcheck.sas

With the SYSIN system option the program will run in batch mode (not sure if this is appropriate for your specific program). The LRECL system option should help to prevent truncation of long lines of code in your program (cf. SAS Usage Notes 5953 and 15883). It is possible that a closing quotation mark was lost due to code truncation, hence the warnings in your log.

Contributor
Posts: 29

Re: SAS Program does not start when started via bat file

Good morning everybody.

First of all thanks for your replies. They were very helpful.

And with the hint of FreelanceReinhard I was able to solve the problem.

With the -lrecl max option I could solve it.

THANK YOU VERY MUCH FOR THIS. I did not know this before.

 

My fault was that I did not really follow the warning "WARNING: The quoted string currently being processed has become more than 262 characters long. 
         You might have unbalanced quotation marks." because I read this article http://support.sas.com/resources/papers/proceedings11/262-2011.pdf and there I understood that this message can be more or less ignored.

 

So thanks again to you for the help.

Best regards

Christobal

Super User
Super User
Posts: 7,401

Re: SAS Program does not start when started via bat file

And the moral of that story, there should never be any warning or errors in your log.  Also, there is a set of notes which should also not be in the log - uninitialised variables, missing values etc.

Contributor
Posts: 29

Re: SAS Program does not start when started via bat file

Oh yes. This is really the moral that I have to accept ;-) For the future I will pay more attention on this. :-)

 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 280 views
  • 1 like
  • 3 in conversation