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";
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
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
* some more parsing code follows;
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.
----- Original Message -----
From: "Florio Arguillas" <foa2@CORNELL.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.
> 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
> 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.
> Best regards,