BookmarkSubscribeRSS Feed
tony_mccray
Calcite | Level 5
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?
8 REPLIES 8
Doc_Duke
Rhodochrosite | Level 12
Tony,

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.

Doc Muhlbaier
Duke
tony_mccray
Calcite | Level 5
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.

Thanks,
Tony
Patrick
Opal | Level 21
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?
tony_mccray
Calcite | Level 5
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.

-Tony
deleted_user
Not applicable
Tony - error log will help figure out issue.
tony_mccray
Calcite | Level 5
Hi sastech. What error log are you referring to? Is this the regular SAS log with certain options turned on, or is there a separate error log I can review elsewhere?

-Tony
deleted_user
Not applicable
sas log with errors.
Ksharp
Super User
Have your Solaris UNIX set up some Anti-virus Software or Fire wall?
If it has ,try to run your code with closing Anti-virus Software or Fire wall temporarily.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 1053 views
  • 0 likes
  • 5 in conversation