10-01-2012 04:56 AM
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.
10-01-2012 09:52 AM
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 ?
10-01-2012 10:01 AM
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.
10-01-2012 10:15 AM
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.
10-01-2012 10:40 AM
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.
10-01-2012 11:54 AM
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.).
10-01-2012 12:21 PM
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.
10-01-2012 10:51 AM
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?
10-01-2012 01:31 PM
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.
10-02-2012 05:04 AM
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"';