Help using Base SAS procedures

Import HTTP

Reply
Contributor
Posts: 38

Import HTTP

Hi,

After spending the better part of the morning searching the Web without success I thought I would ask for help.

Can anyone point me to a simple procedure to import data from a web page?

Thanks

Fred


Super User
Posts: 9,671

Re: Import HTTP

filename x url 'http://......x.html' ;

data x;

infile x ;

input .....

SAS Super FREQ
Posts: 8,742

Re: Import HTTP

Hi, and here is a most recent posting on using the FILENAME engine to read a URL:

https://communities.sas.com/message/197467#197467

If you search the community, you should find others. I know there have been user group papers written about it. Look at some of the hits that I found in the attached screen shot.

cynthia


filename_url_access_google.png
Contributor
Posts: 38

Re: Import HTTP

Hi Cynthia,

I can't get past ERROR: The connection has timed out..

Any suggestions?

Fred

Trusted Advisor
Posts: 2,113

Re: Import HTTP

Fred,

That message indicates an issue between SAS and the html data.

Can you cut-n-paste the html address from the filename into a browser ON THE SAME machine as the SAS server and get to the target?  Sometimes a remote server can have different internet connectivity than a workstation.

Doc Muhlbaier

Duke

Contributor
Posts: 38

Re: Import HTTP

Hi,

What would be required if the web page required you to enter username and password?

Fred

Super User
Posts: 6,928

Re: Import HTTP

With the filename url access method, you can specify user= and pass=.

Alternatively you could try to use wget to download to a local file and read that.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
PROC Star
Posts: 7,360

Re: Import HTTP

Fred,

Does the table show on one screen or is it a large table?  Regardless, if you still run into problems getting the data into SAS, you may want to take a look at: Copy and Paste Almost Anything - sasCommunity

The paper doesn't provide any of the help you've already been given regarding how to read the file directly, but may offer some needed advice for turning the html table into a SAS file.

Contributor
Posts: 38

Re: Import HTTP

Hi everyone and thanks for your comments.

What I ended up doing was linking an Excel file to the URL that contains the data.

SAS opens  the excek file that then refreshes, Sas then imports the refreshed data.

Data validations are then performed.

Fred

Ask a Question
Discussion stats
  • 8 replies
  • 378 views
  • 0 likes
  • 6 in conversation