DATA Step, Macro, Functions and more

importing data from a website

Reply
Occasional Contributor
Posts: 12

importing data from a website

Whats the best way to import the data on this website https://download.bls.gov/pub/time.series/la/la.data.3.AllStatesS

to SAS

Super User
Posts: 19,851

Re: importing data from a website

[ Edited ]
PROC Star
Posts: 7,487

Re: importing data from a website

The paper that @Reeza suggested is definitely a good start, but you can read that file directly. I'd try the following:

 

filename theurl URL "https://download.bls.gov/pub/time.series/la/la.data.3.AllStatesS";

data want;
    infile theurl truncover firstobs=2 dlm='09'x;
    informat series_id $20.;
    input series_id year period	$ value footnote_codes $;
run;

Art, CEO, AnalystFinder.com

Super User
Posts: 19,851

Re: importing data from a website

@art297 its pretty much exactly your code Smiley Wink

Occasional Contributor
Posts: 12

Re: importing data from a website

thank you

Super User
Posts: 19,851

Re: importing data from a website

@Mike7 Please mark the appropriate answer as the correct answer, like Art's solution. NOT this comment please.

Ask a Question
Discussion stats
  • 5 replies
  • 155 views
  • 0 likes
  • 3 in conversation