Date: Fri, 21 Jun 2002 14:44:49 -0400
Reply-To: Howard_Schreier@ITA.DOC.GOV
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Howard_Schreier@ITA.DOC.GOV
Subject: Re: url engine of filename
I expect that the FILENAME function can be used. In my experience, the
documentation is not always exhaustive. In other words, it does not say
that you cannot use URL/Web access method, so give it a try.
In my FTP Access Method paper, there are examples of using the FTP A.M. via
function calls. The coding for URL/Web A.M. should be similar.
See http://www.ita.doc.gov/td/industry/otea/dcsug/ftp.pdf
On Fri, 21 Jun 2002 08:19:35 -0400, Mike Rhoads <RHOADSM1@WESTAT.COM> wrote:
>Peter,
>
>Might it work if you explicitly disassociate the fileref and then
>reassociate and reopen it, for each iteration? I would try this with an
>explicit DO-loop in the DATA step, rather than relying on the implicit DATA
>step looping.
>
>Perhaps you could do this with the FILEVAR option of the INFILE statement.
>You might need to switch the FILEVAR variable value to some dummy value and
>then switch it back.
>
>The other possibility that comes to mind is using the external file
>functions, such as FILENAME, FOPEN, and FCLOSE. FWIW, however, I didn't
see
>the URL option documented for the FILENAME function (as opposed to the
>FILENAME statement).
>
>All untested -- hope it helps!
>
>Mike Rhoads
>Westat
>RhoadsM1@Westat.com
>
>-----Original Message-----
>From: Peter Crawford [mailto:peter@CRAWFORDSOFTWARE.DEMON.CO.UK]
>Sent: Tuesday, June 18, 2002 9:29 AM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: url engine of filename
>
>
>Hi
>I would like to read a web page to collect some exchange rates
>The url engine on a filename statement makes this easy
>%let url = http://uk.finance.yahoo.com:80/q?s=EURGBP%3dX&d=1b ;
>filename foo url "&url" lrecl=32000 ;
>data _null;
> if _n_ gt 100 then stop;
> infile foo dlm='<> ' n=200 ;
> now = datetime() ;
> input @'Last Trade' @ ;
> input @'br' trade_time ?? :time5. @;
> input @'Ask' @ ;
> input @'br' asking ??
> #1 @1 @@ ; /* get back to beginning ready for next iteration */
> put trade_time= : time. asking= now= : datetime. ;
> * if lag( trade_time ) ne trade_time then output ;
>run;
>
>
>What becomes more difficult is to presuade the web page to be refreshed
>when I remove that final *, only one obs is output;
|