Help using Base SAS procedures

Batch file - options lrec=1000

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 18
Accepted Solution

Batch file - options lrec=1000

I am trying to write a batch file and have my sas session allow for fields of 1000 charactors.  Can't seem to get it to work.  Any suggestions. (SAS 9.2)

"C:\Program Files\SAS\SASFoundation\9.2\SAS.EXE"  options lrecl=3000 -icon -noterminal -nosplash -noxwait -noxsync -CONFIG "C:\Program Files\SAS\SASFoundation\9.2\SASV9.CFG"  -SYSIN  "X:\Paul\Programs\Major\Onboarding\Code\onboarding_trial_030_em.sas"  -LOG    "X:\Paul\Programs\Major\Onboarding\Code\onboarding_trial_030_em.log"


Accepted Solutions
Solution
‎08-17-2011 01:54 PM
Trusted Advisor
Posts: 1,300

Re: Batch file - options lrec=1000

Since you appear to try and execute this code as a batch process your should add the -batch system option.  All system options should be defined by -[option] <[value]>

C:\Program Files\SAS\SASFoundation\9.2\SAS.EXE"  -batch -lrecl 3000 -icon -noterminal -nosplash -noxwait -noxsync -CONFIG "C:\Program Files\SAS\SASFoundation\9.2\SASV9.CFG"  -SYSIN  "X:\Paul\Programs\Major\Onboarding\Code\onboarding_trial_030_em.sas"  -LOG    "X:\Paul\Programs\Major\Onboarding\Code\onboarding_trial_030_em.log

Usually I prefer to keep lrecl option parameters inside my programs and use an options statement or on my filename statement or infile statement.

Options Statement syntax:

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000289431.htm

Filename Statement syntax:

http://support.sas.com/documentation/cdl/en/hostwin/63285/HTML/default/viewer.htm#chfnoptfmain.htm

Infile Statement syntax:

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000146932.htm

View solution in original post


All Replies
PROC Star
Posts: 7,366

Batch file - options lrec=1000

Take a look at: http://support.sas.com/kb/15/883.html

You have to be runing 9.2 or newer and the options has to be in the configuration file.

From the above mentioned documentation:

Submitting a SAS program via a batch file imposes a maximum

     length limit of 256 characters prior to SAS 9.2.  For SAS 9.2

     and beyond you can use the new SAS system option of LRECL= to

     specify a range of 1-32767 to use for reading and writing

     external files.  The default for the LRECL= system option is

     256.  This option is valid in the configuration file, at SAS

     invocation, the OPTIONS statement, or the SAS Systems Option

     window.  Under z/OS, the LRECL= system option is recognized only

     for reading and writing HFS files.

Occasional Contributor
Posts: 18

Batch file - options lrec=1000

I have read this but I am unable to decipher.  Looking for an example of where I put the options statement (batch file or cfg file) and how do I write it.

PROC Star
Posts: 7,366

Batch file - options lrec=1000

I read it wrong.  It is valid in all of those places.  Have you tried simply removing the word 'options'?

Occasional Contributor
Posts: 18

Batch file - options lrec=1000

Tried that (with and without dash in front of options)  Doesn't work.  See my original post

PROC Star
Posts: 7,366

Batch file - options lrec=1000

Have you tried it in the following way?  immediately following sas.exe,

..etc.etc..sas.exe -lrecl 1000

Solution
‎08-17-2011 01:54 PM
Trusted Advisor
Posts: 1,300

Re: Batch file - options lrec=1000

Since you appear to try and execute this code as a batch process your should add the -batch system option.  All system options should be defined by -[option] <[value]>

C:\Program Files\SAS\SASFoundation\9.2\SAS.EXE"  -batch -lrecl 3000 -icon -noterminal -nosplash -noxwait -noxsync -CONFIG "C:\Program Files\SAS\SASFoundation\9.2\SASV9.CFG"  -SYSIN  "X:\Paul\Programs\Major\Onboarding\Code\onboarding_trial_030_em.sas"  -LOG    "X:\Paul\Programs\Major\Onboarding\Code\onboarding_trial_030_em.log

Usually I prefer to keep lrecl option parameters inside my programs and use an options statement or on my filename statement or infile statement.

Options Statement syntax:

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000289431.htm

Filename Statement syntax:

http://support.sas.com/documentation/cdl/en/hostwin/63285/HTML/default/viewer.htm#chfnoptfmain.htm

Infile Statement syntax:

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000146932.htm

Occasional Contributor
Posts: 18

Batch file - options lrec=1000

THANKS!  Worked like a charm.  Sorry just not that good at White Papers.

🔒 This topic is solved and locked.

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

Discussion stats
  • 7 replies
  • 1145 views
  • 0 likes
  • 3 in conversation