LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (April 2010, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 23 Apr 2010 13:00:26 -0400
Reply-To:     Nat Wooding <nathani@VERIZON.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Nat Wooding <nathani@VERIZON.NET>
Subject:      Re: Retrieving data on a website
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
              reply-type=response

Florio

Here is a portion of a job that reads a bit of information from our corporate website. The background is that we are required to report water temperatures from at one of our nuclear plants and these temperatures are displayed on the corporate website. Since several people were opening the site daily in order to verify that everything was working properly, I set up a batch job that would run every morning and display the most recent value along with the date and time that it was recorded. Here is enough code to show how I read the web page.

filename whtf url 'http://dom.com/about/stations/nuclear/north-anna/waste-heat-treatment-facility.jsp';

Data whtf;

infile whtf length = len firstobs =500 lrecl=5000 ;* was 627;

length str $ 500;

input ;* read the current line of html into the input buffer;

if index( _infile_ , 'Degrees' ) then do;

flag = 1;* we have found the line immediately before the water temperatures;

retain flag;

return;

end;

if flag;

* some more parsing code follows;

run;

Our website has a fixed layout so I took advantage of this and use the firstobs to skip to the page that has the

information that I want. The values then go into macro variables which are inserted into an email that goes to interested

folks. What's more, the major information is displayed in the subject line so unless they need more details, they don't

even have to open the email. But, I digress.

Nat Wooding

----- Original Message ----- From: "Florio Arguillas" <foa2@CORNELL.EDU> To: <SAS-L@LISTSERV.UGA.EDU> Sent: Friday, April 23, 2010 11:14 AM Subject: Retrieving data on a website

> Hi everyone, > > I am interested in retrieving a value posted on a particular website. > This > value changes each night and located in a fixed location on the site. > > Every night I want to use SAS to retrieve that value and store it as a SAS > dataset, so I can append it to another dataset containing the previous > ones > that I've retrieved . > > Is this possible in SAS? I know how to schedule the SAS job, but don't > know the code to retrieve the value on a website. > > TIA. > > Best regards, > > Florio


Back to: Top of message | Previous page | Main SAS-L page