Take a look at: http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0312e&L=sas-l&D=1&O=A&m=167104&P=3830
or, in short form: http://tiny.cc/0w6mz
In that post, Paul Choate said that he successfully tried the following method:
FILENAME website HTTP
'http://www.iso-ne.com:80/settlement-resettlement/SMD_operating_reserves_sum
mary/200311_OR_Summary.xls';
data file;
n=-1;
infile website recfm=s nbyte=n length=len;
input;.
file "200311_OR_Summary.xls" recfm=n;
put _infile_ $varying32767. len;
run;
PROC IMPORT OUT= WORK.D200311_OR_Summary_NEMA
DATAFILE= "200311_OR_Summary.xls"
DBMS=Excel REPLACE;
RANGE="A3:G80";
sheet="NEMA";
getnames=yes;
RUN;
HTH,
Art
This afternoon I needed this very solution. Thanks to both of you, Paul and Art.
John Bentley
thank you for posting this! It made me smile to know that the original post, created in 2010 by SAS users, helped you this afternoon in 2014
Hi Arthur,
I would like to use your code to download xlsx from URL. The URL automatically prompts from the username and password so I included the ppuser= ppass= debug
However, I encountered the ERROR: The connection has timed out.. after the data step. Please assist.
16 FILENAME srm HTTP 'http://srm.edragonedit.com/stat/overall/download' puser="srmall" ppass=XXXXXXX debug;
17
18
19 data file;
20 n=-1;
21 infile srm recfm=s
22 nbyte=n length=len;
23 input;
24 file "srm_vouchers_overall.xlsx" recfm=n;
25 put _infile_ $varying32767. len;
26 run;
ERROR: The connection has timed out..
NOTE: UNBUFFERED is the default with RECFM=N.
NOTE: The file "srm_vouchers_overall.xlsx" is:
Filename=D:\SAS\Config\Lev1\SASAppEM\srm_vouchers_overall.xlsx,
RECFM=N,LRECL=256,File Size (bytes)=0,
Last Modified=28Jul2015:17:06:01,
Create Time=28Jul2015:16:36:20
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.FILE may be incomplete. When this step was stopped there were 0 observations and 0 variables.
WARNING: Data set WORK.FILE was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 25.75 seconds
cpu time 0.00 seconds
27
28 PROC IMPORT OUT= WORK.srm_vouchers_overall
29 DATAFILE= "srm_vouchers_overall.xlsx"
30 DBMS=Excel REPLACE;
31 RANGE="A3:G80";
32 sheet="overall";
33 getnames=yes;
34
35 GOPTIONS NOACCESSIBLE;
36 %LET _CLIENTTASKLABEL=;
37 %LET _CLIENTPROJECTPATH=;
38 %LET _CLIENTPROJECTNAME=;
2 The SAS System 15:31 Tuesday, July 28, 2015
39 %LET _SASPROGRAMFILE=;
40
41 ;*';*";*/;quit;
1 The SAS System 17:06 Tuesday, July 28, 2015
ERROR: Connect: Class not registered
ERROR: Error in the LIBNAME statement.
Connection Failed. See log for details.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.32 seconds
cpu time 0.04 seconds
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.