BookmarkSubscribeRSS Feed
olearczuk
Calcite | Level 5

Hi,

i am attempting to read data in XML format from URL:

https://danepubliczne.imgw.pl/api/data/synop/format/xml

 

Unfortunately I can't method presented below to work.

http://documentation.sas.com/?docsetId=engxml&docsetTarget=n1d4p29qcfovrxn1k4nalh0bz4n6.htm&docsetVe...

 

My code is following

 

 

filename imgw url 'https://danepubliczne.imgw.pl/api/data/synop/format/xml';
filename map 'C:\imgw_map.map';
libname imgw xmlv2 xmlmap=map access=readonly;
data xml;
set imgw.item;
run;
proc contents data=xml;quit;

 

 

imgw_map was created in SAS XML Mapper using 'AutoMap using XML' on a download data file.

 

Code doesn't return any errors, imgw library is created with 2 files, but unfortunately those sets are empty (no observations).

 

Surprisingly using nearly identical code, but for downloaded data gives correct results.

 

filename imgw 'C:\imgw_synop.xml';
filename map 'C:\imgw_map.map';
libname imgw xmlv2 xmlmap=map access=readonly;
data xml;
set imgw.item;
run;
proc contents data=xml;quit;

Data set is frequently updated (weather data) and I would like my data to update itself automatically without manual downloads.

 

I am using SAS 9.4 in Enterprise Guide 7.11.

 

best regards.

 

 

 

 

 

 

 

 

2 REPLIES 2
Satish_Parida
Lapis Lazuli | Level 10

The URL is a service returning the data which your browser is displaying.

 

To capture the data you have to use either proc http or proc soap.

 

I have added a code snippet for your reference.

 

filename resp "&WORKING_DIR./output.xml";
proc http 
url="&URL_ADVERSE." 
out=resp
METHOD='GET';
run;

Please let us know if it worked for you.

KevinViel
Pyrite | Level 9
Great tip! This helped me a lot right now.

sas-innovate-2024.png

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.

 

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
  • 2 replies
  • 1064 views
  • 2 likes
  • 3 in conversation