Help using Base SAS procedures

Import CSV from the Web

Reply
SAS Employee
Posts: 89

Import CSV from the Web

Ok folks my turn to ask for help....

I want to know how to import this file from the web. https://raw.githubusercontent.com/sassoftware/enlighten-integration/master/SAS_Base_OpenSrcIntegrati...

And I want to do it in as few calls as possible.  Either a PROC IMPORT or a FILENAME.

Any guidance you can provide is appreciated.

Going one step further, what if it was an .xls?

Thanks in advance-K

Super User
Posts: 10,535

Re: Import CSV from the Web

filename testurl url "https://raw.githubusercontent.com/sassoftware/enlighten-integration/master/SAS_Base_OpenSrcIntegrati...";


proc import file=testurl out=work.junk dbms=csv;run;

would be the approach but it times out on me.

Respected Advisor
Posts: 3,900

Re: Import CSV from the Web

Your code works perfectly for me with SAS9.4 under Win7 64bit

Super User
Super User
Posts: 6,502

Re: Import CSV from the Web

Seems pretty easy.  Binary format like an Excel file would be harder, you might want to first copy it to a temporary file.

filename testurl url "https://raw.githubusercontent.com/sassoftware/enlighten-integration/master/SAS_Base_OpenSrcIntegrati...";


data want;

infile testurl dsd firstobs=2;

input label pixel0-pixel783 ;

run;

Super User
Posts: 9,687

Re: Import CSV from the Web

It is easy to import Binary format like Excel file as well for SAS .Check it out .

http://blogs.sas.com/content/sasdummy/2013/09/17/copy-file-macro/

Xia Keshan

Ask a Question
Discussion stats
  • 4 replies
  • 1998 views
  • 0 likes
  • 5 in conversation