Help using Base SAS procedures

Filename url - Hostname not found

Accepted Solution Solved
Reply
Regular Contributor
Regular Contributor
Posts: 166
Accepted Solution

Filename url - Hostname not found

Hi all,

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.


Accepted Solutions
Solution
‎11-12-2012 10:51 AM
Contributor
Posts: 27

Re: Filename url - Hostname not found

Hi,

would you test from your unix server whether you can reach the host?

$ ping host

$ telnet host 81

Regards,

Sándor

View solution in original post


All Replies
Super Contributor
Posts: 644

Re: Filename url - Hostname not found

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:

http://hostname/file

http://hostnameSmiley Tongueortno/file

Richard in Oz

Regular Contributor
Regular Contributor
Posts: 166

Re: Filename url - Hostname not found

Posted in reply to RichardinOz

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.

Super Contributor
Posts: 644

Re: Filename url - Hostname not found

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

Solution
‎11-12-2012 10:51 AM
Contributor
Posts: 27

Re: Filename url - Hostname not found

Hi,

would you test from your unix server whether you can reach the host?

$ ping host

$ telnet host 81

Regards,

Sándor

Regular Contributor
Regular Contributor
Posts: 166

Re: Filename url - Hostname not found

Posted in reply to SandorSzalma

Thanks.. i did ping the host.. and used the ip address of the client in the url instead of the Host name... Its working fine now...

Thanks all..

🔒 This topic is solved and locked.

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

Discussion stats
  • 5 replies
  • 1030 views
  • 0 likes
  • 3 in conversation