11-12-2012 04:10 AM
I am trying to use a filename statement to read the files in a url.
filename myfile url "http://host:81/PATH1/";
When calling this filename i keep getting the error Hostname not found.
I am able to access the url via my internet explorer. However my sas version is on a unix platform.
Any suggestions on how do i take this ahead ?
I did try the debug statement but there were not notes for debug.
11-12-2012 04:38 AM
Is PATH1 the name of the file you are trying to access? If so, try
filename myfile url "http://host:81/PATH1"; (ie without the final /) or if there is an extension (like .html) include that explicitly.
But if not you may need to explicitly name the file. The SAS UNIX documentation states
The URL must be in one of these forms:
Richard in Oz
11-12-2012 05:08 AM
Hi richard.. the PATH1 is a directory which contains the files that i wish to read and import.
My objective is to list all the files in a url Path and then import required files.
I have tried /PATH1/ and also /PATH1 but still the error remains.
I did try connecting to another host using the same statment and it was working fine there
but somehow the system seems to be unable to identify this host.
11-12-2012 05:22 AM
From the documentation I would not expect you to be able to access a directory using the URL option. But I do not have access now to a setup I could check this on. You say you have been able to connect to another host with this syntax; maybe there are file or directory permissions which differ.
Another tack I have used in the past is to use an external ls command with the ouput piped to a named text file. You can read the filenames into a table and proceed from there. I have not tried that with a URL but it might be worth examining as an option if other methods fail.
Richard in Oz
Need further help from the community? Please ask a new question.