SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
scwein
Fluorite | Level 6

Hello,

 

My organization has recently moved to a new Linux Server, and I've found that when I submit a SAS job  through the terminal (I suppose this means in "batch" mode), I cannot access the logs produced by that job until it is complete. I do not have this problem when I use "Background Submit" in SAS Studio - there I can view the logs and monitor the progress of the program while it runs. I'm not sure if this is relevant, but I got into the habit in the previous UNIX environment of using the option:

-logparm "write=immediate"

so that I would be able to monitor progress as the log was written, but that does not seem to help with this issue.

 

If it's helpful, the SAS version is 9.4. and the SAS Studio release is 3.82 Enterprise Edition. Both ultimately connect to the same server so I'm confused about why they seem to work quite differently, but that should probably be a separate question entirely.

 

The main question is if there's a way to submit a SAS job via the terminal and view the log from that job before the program is finished running.

Note that I have seen that there's an option to "rollover" the log, but I really don't want to produce hundreds of separate logs, I would just like one that I can monitor while it runs.

 

Thanks!

7 REPLIES 7
ChrisNZ
Tourmaline | Level 20
> I cannot access the logs produced by that job until it is complete

What message do you get? Please describe what happens. You should be able to see the log.
Kurt_Bremser
Super User

Different UNIX, but still UNIX: on our AIX server I maintained a dataset of running and finished jobs, and created a report page from it which contained links to the log files (the report was updated every time a job started or finished). We were always able to view logs of jobs in progress by updating the page in the browser.

 

How do you view the log file?

scwein
Fluorite | Level 6

@ChrisNZ@Kurt_Bremser:

I have tried several different approaches to view the log: opening it up with gedit, using "cat" "head" "tail" and "more" commands in the terminal, making a copy of the log to a different directory, etc. All failed, saying I didn't have permission to view/access the log (but I'm confident that I do have permission, and this is no longer a problem once the program is finished running).

 

One possibly important detail is that the drive to which these logs are being written is a weird hybrid drive that is, as I understand it, actually a Windows drive, but set up to be accessed from both Linux and Windows servers. This has created identified problems with SAS in other regards (such as assigning "libnames"), and our whole organization is still on a learning curve trying to figure out the transition to this new system. But I searched for this issue quite a bit before posting, and others have described similar limitations, but I didn't see any clean solutions.

 

One further update: a colleague told me that he was able to work around this issue by using -altlog and writing to a Linux-native drive. So that seems to be a decent solution, at least for the moment (though I wouldn't be able to write the main log there, as my understanding is that it is meant to be for temporary files only). But if anyone has other suggestions, I'd be interested to hear.

 

Thanks!

ChrisNZ
Tourmaline | Level 20
Windows manages files in a more basic manner than Unix does, and normally locks files being written. It's very likely that Windows denies any access requests by processes other than the one writing.
SASKiwi
PROC Star

If this is a Windows drive and you can access it from your PC using Windows Explorer then try viewing with Windows Notepad.  i use this all the time in Windows SAS installations to view SAS batch logs while the jobs are still running. If it still fails then I can only assume it is something peculiar relating to linux.

scwein
Fluorite | Level 6

@SASKiwi Yep, I have tried this, doesn't work. It could be that the issue is that it's a SAS UNIX installation, but the drive where the file is stored is a Windows directory. Unfortunately, that is how the system is set up, so it could be that the only workaround is the one I mentioned above using "altlog."

 

Thanks!

Kurt_Bremser
Super User

Windows is notoriously bad with regards to keeping files unnecessarily open.

Set up file shares on Linux servers with samba where needed.

But if you already log in to the SAS server with SSH, you don't need a share at all, and can keep the log files on storage used exclusively by Linux. Accessing these from other platforms can be done with samba or webdav.

 

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1104 views
  • 6 likes
  • 4 in conversation