BookmarkSubscribeRSS Feed
mediaeval
Calcite | Level 5

Hi,

I am referencing a file on a drive in an Infile statement which requires password access. Is there an option in the Infile statement that will allow me to provide the password automatically, or some other method, such that SAS can process the request, instead of reporting an error in the Log? At the moment I go to Windows Explorer and log in there, but I would prefer to do this automatically.

Thanks

Joe

10 REPLIES 10
Ksharp
Super User

INFILE statement is often used to import raw file such as txt csv ... file.

I have never meet a raw file which need a password .That is too weird .

Or Do you mean your file is actually a SAS Dataset ?

Ksharp

mediaeval
Calcite | Level 5

The raw file (a txt file) resides on a drive, where the drive is password-protected. If I am not logged onto that drive, and my SAS Program tries to access it (using the Infile statement), an error is generated in the Log.

Doc_Duke
Rhodochrosite | Level 12

Mediaeval,

I agree with Ksharp that I hadn't heard of password protected files.  At least not in Windows.  WinZip does it for multiple files, but it is a copy process, not just a password process.

There are a lot of ways to password protect a drive (PGP, Guardian Edge, PC manufacturer's software, USB Secure, IronKey, etc.).  In order to pass the password in what amounts to a batch mode, you need to find the documentation for the process used to protect it and see if they have a way to do it.  We can't help you with the little information that you provided.  Unless we have tried it with your particular flavor of protection, we won't be able to do much more than search for the documentation.

Doc Muhlbaier

Duke

mediaeval
Calcite | Level 5

Hi all,

Thanks for your comments and apologies for the confusion. I’ll try to be more specific. The file itself is not password protected – it’s just a text file. The drive it resides on is password protected. The drive itself represents another computer on the network, which I have mapped to the letter Z in Windows Explorer, so I reference the file as “Z:\MyDir\MyFile.txt”. It's a Windows XP network.

When I logon to my own computer each day, I am required to log on using my own Windows ID and Password. Each person in the department has their own Windows ID and password. The particular computer on which the file resides has a specific login name and password so that anyone can access it, and each person in the department has mapped it in Windows Explorer to the letter Z. At present, in order to logon to this drive, I open up Windows Explorer, click on Z, and I am asked for the username and password, which I input. I don’t know if there is a specific software program protecting that drive – I’m pretty sure it’s a Windows Standard Logon, just like the one I use when I logon in the morning? I could find out. I hadn’t thought that it was relevant.

I had hoped that Infile might have an option similar to the Ftp command in SAS. When I use the Ftp command (as in the following example), I can pass a username and password to our mainframe, which logs me on and allows me to access the specified file in code.

Filename Xrrors   ftp "'PR.LD.FILEUP.S020F02'" Host='prodhost' User='User10' Pass='PassMe' Debug lrecl=76  recfm=f;

I hope that’s clearer, please let me know.

Thanks

Joe

Doc_Duke
Rhodochrosite | Level 12

When you map a drive in Windows XP, it give you the option to put in your user-id and password and to cache them.  Put in the password when you map the drive and you should be good to go (unless, of course, your network admins have established a registry policy that requires re-entry each login.  If that is true, you are stuck with a manual password entry.).

mediaeval
Calcite | Level 5

Hi Doc,

You are right about the network admins - I'm required to enter the password at each login, even though I have ticked the box that says "Reconnect at logon", when I initially map the drive.

Thanks

Joe

TomKari
Onyx | Level 15

In the encryption solutions that I've used, you first use the encryption software to "mount" the secure drive or file, after which it appears as a different drive letter, which can be used normally. Could it be you need to do the first step before accessing the file from SAS?

Tom

Tom
Super User Tom
Super User

Did you try running the NET USE command to map the drive to drive letter?

From DOS prompt you can type:  net user /help

to see the syntax.

If you can get that to work then you can call it from SAS with an X cmd or using a filename with a pipe.

mediaeval
Calcite | Level 5

Hi Tom,

This is what I was looking for - using 'net use' I can log onto the drive in code, before the Infile statement. Here's what I used:

/* delete or unmount device to start afresh */
x 'net use Z: /DELETE';

/* remap your device */
x 'net use Z: \\master3\c /USER:username "password"';

Thanks everyone,

Joe

Ksharp
Super User

Or you should check filename or libname 's webdav accessing method .

FILENAME, WebDAV Access Method

LIBNAME, WebDAV Access Method

Ksharp

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 10 replies
  • 2275 views
  • 0 likes
  • 5 in conversation