BookmarkSubscribeRSS Feed
Anita_n
Pyrite | Level 9

Dear all, 

I need some help, I wish to extract some excel files from this website:

https://www.destatis.de/SiteGlobals/Forms/Suche/Expertensuche_Formular.html?resourceId=2402&input_=2...

 

@Kurt_Bremser helped me some time ago with this solution:

filename ht temp;

proc http
  url="https://www.destatis.de/DE/Themen/Laender-Regionen/Regionales/Gemeindeverzeichnis/Administrativ/Archiv/GVAuszugJ/31122020_Auszug_GV.xlsx;jsessionid=B4477D957BFAB0E007E62A86373ED7F9.live711?__blob=publicationFile"
  out=ht
;
run;

proc import
  datafile=ht
  out=test
  dbms=xlsx
  replace
;
sheet="Onlineprodukt_Gemeinden";
run;

The problem I have now is I wish to extract all excel files which has a date 31.12.1999, 31.12.2000, 31.12.2001 ....... and so on till 31.12.2021

 

What can I add to the above code to accomplish this task?

 

Can anyone help please?

 

Please note:

What I realised in the url is that the name of the excel sheet also contains the date (see below in link, I have highlighted this in red)

"https://www.destatis.de/DE/Themen/Laender-Regionen/Regionales/Gemeindeverzeichnis/Administrativ/Arch...31122020_Auszug_GV.xlsx;jsessionid=B4477D957BFAB0E007E62A86373ED7F9.live711?__blob=publicationFile"

 

Please also note that the excel files might be found on different pages

4 REPLIES 4
JosvanderVelden
SAS Super FREQ
Based on the search link (first link in the post) you send it seems to me there are only 12 files to download. The time it will take to create the code and test will surely be a lot more then just clicking 12 times to download the files.
The coding challenge is interesting and solving it will be rewarding. But taking into account the effort I suggest you just click the 12 links, unless you need similar code for similar tasks in the future.

Best regards, Jos
Anita_n
Pyrite | Level 9

It is not only about 12 files but about several from 1999 to 2021 and further years. I will still appreciate any help

Reeza
Super User

It's doable but not as simple as your original question by any fashion. Scraping is a bit of guess and test and digging into the data. 

https://blogs.sas.com/content/sasdummy/2017/12/04/scrape-web-page-data/

 

 

Anita_n
Pyrite | Level 9

Yes, you are right, I believe it's not so easy, but maybe someone can help anyway

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 435 views
  • 1 like
  • 3 in conversation