BookmarkSubscribeRSS Feed
fred_major
Calcite | Level 5

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


8 REPLIES 8
Ksharp
Super User

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

data x;

infile x ;

input .....

Cynthia_sas
SAS Super FREQ

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
fred_major
Calcite | Level 5

Hi Cynthia,

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

Any suggestions?

Fred

Doc_Duke
Rhodochrosite | Level 12

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

fred_major
Calcite | Level 5

Hi,

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

Fred

Kurt_Bremser
Super User

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.

art297
Opal | Level 21

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.

fred_major
Calcite | Level 5

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 1368 views
  • 0 likes
  • 6 in conversation