We currently run a number of SAS jobs by launching a .bat file. Now i am aware there is a limit on the characters when submitting via batch:
http://support.sas.com/kb/15/883.html
Now i assumed I could use this option per:
https://communities.sas.com/t5/SAS-Procedures/Batch-file-options-lrec-1000/td-p/49903
However it will not work, when it accepts the option for LRECL it ignores the specification of the LOG and PRINT locations and goes to the default instead. I am using Powershell to initial SAS which works fine until now that i have added additional characters which pushed it over its limit can anoyone see what is wrong?
$CMD = "C:\Program Files\SAS\SASFoundation\9.2\sas.exe"
$batch = "-batch"
$lrecl = "-lrecl"
$lrcelconfig = "1000"
$sysparm = "-sysparm"
$sysparmcode = ((Get-Date).ToString('ddMMMyy:HH:mm:ss'))
$config = "-CONFIG"
$configfile = "C:\Program Files\SAS\SASFoundation\9.2\nls\en\SASV9_SCHEDULER.CFG"
$sysin = "-SYSIN"
$sysinfile = "\\xxxxxxxxxxx\xxxx\xxxxxxxxxxxxxxx\xxxxxxxxx\xxxx\xxxxx\code\sy_ct_main_v1.sas"
$print = "-PRINT"
$printfile = "\\xxxxxxxxxxx\xxxx\xxxxxxxxxxxxxxx\xxxxxxxxx\xxxx\xxxxx\log\sy_ct_main_v1_$((Get-Date).ToString('yyyyMMdd_HHmm')).lst"
$log = "-LOG"
$logfile = "\\xxxxxxxxxxx\xxxx\xxxxxxxxxxxxxxx\xxxxxxxxx\xxxx\xxxxx\log\sy_ct_main_v1_$((Get-Date).ToString('yyyyMMdd_HHmm')).log"
& $CMD $batch $lrecl $lrcelconfig $sysparm $sysparmcode $config $configfile $sysin $sysinfile $print $printfile $log $logfile
Running: SAS 9.2 TS2M3
When i Run the above SAS runs but for some reason it is ignoring the Print and the Log Locations, however if remove the lrecl option it says you have to specifiy the log location which i know is the error where it has run out of space on the command.
The LRECL= commandline option of SAS does not affect the length of the commandline, it affects the length limit for external files (like your .sas, .log and .lst files). The length of the commandline is a limit set by the operating system.
The real reason for your problems might not be SAS at all:
Windows imposes a limit on the length of absolute pathnames (this also means fully qualified filenames) which is 260 bytes.
Similar limits exist in other OS's and the respective file system drivers (jfs, ufs, ext3/ext4 and so on all have a limit of 255 characters)
Try to reduce complexity. At the start of the script, cd to a directory from where you have short, simple shortcuts to your program, log, print and config file locations. From there, use relative paths.
Or reduce your path length overall. Just imagining having to type such monstrosities makes me cringe.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.