Error recognizing local drive when running SAS in batch mode Windows

Accepted Solution Solved
Reply
Contributor
Posts: 34
Accepted Solution

Error recognizing local drive when running SAS in batch mode Windows

Hello,

I am struggling with an error that I receive when running SAS in batch mode where the system can't seem to recognize a local mapped network drive. I am receiving the error, "Physical file does not exist, "filepath" when running both proc import and data steps using the infile command. The drive is correctly recognized when I run the program through the enhanced editor of BASE SAS 9.4 when I run it interactively. I am curious why I should receive the error when running in batch mode (which to me seems closer to the local machine than SAS itself) but not interactively. Is this a known issue or do I need to look into windows credentials (perhaps windows processes the permissions differently)? Any help would be much appreciated.

Best,

Daniel


Accepted Solutions
Solution
‎06-24-2015 03:49 AM
Esteemed Advisor
Posts: 5,198

Re: Error recognizing local drive when running SAS in batch mode Windows

Default for Windows Tasks is to run as Local System Account. that user usually can't see any logical mapped disks.

using network resources is also limited, a local account usually have no rights throughout the network.

So use a user with the necessary rights, and use UNC, not a drive letter.

Data never sleeps

View solution in original post


All Replies
Esteemed Advisor
Posts: 6,647

Re: Error recognizing local drive when running SAS in batch mode Windows

How do you run the batch job? From a cmd window started in your desktop environment, or from the scheduler, or with any other method?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 34

Re: Error recognizing local drive when running SAS in batch mode Windows

Through the windows scheduler using a .bat file:

The program runs fine and the log is produced with the exception of being able to read from the local mapped network drive.

Esteemed Advisor
Posts: 6,647

Re: Error recognizing local drive when running SAS in batch mode Windows

Then you may have a problem with the way the WIndows scheduler sets up the environment before running the .bat.

eg different user, different policies for scheduled vs. desktop etc. which cause you to not have the network drive mapping.

Just came to my mind: did you mount that network drive by yourself in Windows Explorer, or is it mounted already by the system? The scheduler most probably does not honor mounts done in the user's desktop.

So you might need to do the mount in the .bat with the net use command.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Solution
‎06-24-2015 03:49 AM
Esteemed Advisor
Posts: 5,198

Re: Error recognizing local drive when running SAS in batch mode Windows

Default for Windows Tasks is to run as Local System Account. that user usually can't see any logical mapped disks.

using network resources is also limited, a local account usually have no rights throughout the network.

So use a user with the necessary rights, and use UNC, not a drive letter.

Data never sleeps
Respected Advisor
Posts: 3,063

Re: Error recognizing local drive when running SAS in batch mode Windows

How are you referring to your mapped drive? With a drive letter or a UNC (\\NetworkServerName\FolderName)? If you use a drive letter I would try the UNC approach.

Contributor
Posts: 34

Re: Error recognizing local drive when running SAS in batch mode Windows

I am using the letter drive since I was unfamiliar with UNC. Can anyone suggest a good article summarizing UNC and their use in the SAS environment? Even better if it includes information regarding the metadata server.

Thank you all for the helpful responses,

Daniel

Esteemed Advisor
Posts: 6,647

Re: Error recognizing local drive when running SAS in batch mode Windows

This:

Path (computing) - Wikipedia, the free encyclopedia

describes the UNC syntax. Just replace your drive letters with server name and network share name before adding the relative path that you already have.

Be prepared that you need to initiate the network connection before using it, as it may be necessary to provide credentials to the network server.

Ask your organization's Windows support group, they know your network architecture.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Valued Guide
Posts: 3,206

Re: Error recognizing local drive when running SAS in batch mode Windows

The scheduler task manager is running on a local service account. I think it is correct Linus mentioned the local system one. The Microsoft segregation of default system accounts is far more advanced as with Unix. 

The goal of all that is with security goals preventing too quick high privileged rights. That local system account is not your personal account and is not having that kind of rights. It can be blocked to use intranet resources like unc naming conventions.

Using this unc connections it can be needed to have them associated wit your user an password in scripting or there must be a user context switch first to your user.

Scheduling can be quite advanced with all technical requirements being needed to fulfilled.  That is why there are that many tools arround and it is getting centralized to some dedicated operational departments.

Do not expect your local personal machine setup will be inherited by any scheduled approach. To make those things manage able it should be part of your local sas architecture (installation pre req)

---->-- ja karman --<-----
Esteemed Advisor
Posts: 6,647

Re: Error recognizing local drive when running SAS in batch mode Windows

"The Microsoft segregation of default system accounts is far more advanced as with Unix. "

s/advanced/bloated/

Comparing the working of the cron daemon with the haphazard tries of the Redmonders to create something similar just causes me to ROFLMAO.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Valued Guide
Posts: 3,206

Re: Error recognizing local drive when running SAS in batch mode Windows

Do not frustrated Kurt IWA doc at sas is rather complete. It describes those machine/domain setups.

With Unix there is no concept like that with machines/domains. Please accept that difference.

Yes cron  and crontab are nice tools. I know them and it is the same experience with Unix admins. They are not allowed to be used by normal Sas users.

As the cron daemon is starting a clean user session the scripting is more demanding. The user profile and application profiles are not started. Same issue as with those drive letters.

Than SAS staff is going to demand root access and change the system settings to "correct" that. Harming the system standards at the OS level. By the way I believe the at command is hidden used by scheduling the "metadata backup" that isn't a backup but offload.

---->-- ja karman --<-----
☑ This topic is SOLVED.

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

Discussion stats
  • 10 replies
  • 335 views
  • 3 likes
  • 5 in conversation