I'm having a pretty strange problem. I've got a script with several macros that works fine when run manually in a SAS session, but fails if automated. I'm in a Solaris UNIX environment, and so my SAS jobs are automated via cron jobs. I've had similar jobs (and an earlier version of the script I'm having problems with) running for years without issues.
The strange part is, the script fails where it is trying to execute a data step to reduce a large data set down with a where statement. When run manually the result is a dataset with over 1000 rows. When run under automation the result is an empty data set - because the source data set appears empty! This step is part of a loop, and in this case it is the second time the loop executes. The first time it executed everything was fine.
There is a second data set that is empty at this step that shouldn't be. This data set is one that I build with datalines before executing the macro. As far as I know there are no functions in my script that should be deleting the contents of all my data sets. I've got a lot of options set (mprint mprintnest mlogic mlogicnest symbolgen serror merror source source2) to try and get more info, but nothing is pointing to an obvious problem.
I know this isn't much to go on, but does anyone have any thoughts? Is there some more debug functions I can enable to try and get more info as to what is happening?
Try running it from the command line in batch. If that runs OK, then the problem is in some environment variable that is getting set (or, more likely, not getting set) in the cron.
Some other possibilities to look at. These won't show up with the options you mentioned:
Look at the autoexec.sas that is run. It is possible that SAS is using a different one in interactive vs batch.
Ditto the SAS configuration file.
Thanks for your reply Doc. I ran in batch from the command line and found the same problem. Everything should be the same between environments where I run manually versus automation. I do have a .cfg file set up to definie a specific WORK directory, but that has been running fine since May. Just to check I removed it, and I still have the same problem. It is only this script out of about 10 being automated that is having issues.
Additionally to Doc's hint's (and I suspect this is where the problem lies) - are you running your batch SAS jobs with the same user and on the same SAS Workspace server than when running in a SAS session?
Hi Patrick. I'm definitely running as the same user whether I'm in a session or under automation. I don't know the answer to if I'm on the same SAS Workspace server. I am using different servers to automate versus a live session, but as far as I know the same instance of SAS is being accessed and executed.