- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have multiple xml.gz files in a folder and I have a macro to read multiple xml files to have some output in SAS dataset. However, I need to explicitly and manually extract those xml.gz to xml files before runnning them in a macro.
I was wondering if there is an option where I can use gzip zip filename option along with xml filename option (SXLELIB). So, that I can directly read xml.gz files in the xml reading macro.
- For e.g. if I can add this option:
filename fromzip ZIP "C:\Temp\Folder\data1.xml.gz" GZIP;
- to the below filename and libname statements of xml:
filename SXLELIB "C:\Folder\data1.xml";
filename SXLEMAP "C:\XMLMap\xmlmap.map";
libname SXLELIB xmlv2 xmlmap=SXLEMAP access=READONLY;
What do you think? (I see lot of solutions for directly reading .gz files by filename gzip zip option but not sure if can be combined with xml reader filename).
Thank you already for reading it and giving a thought (if you do) 🙂
Cheers!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I do not think you can combine the GZIP filename with the XML libname in a meaningful way.
Meaning that you will have to extract the file from the gz archive before assigning it to a libname, e.g.
filename fromzip ZIP "C:\Temp\Folder\data1.xml.gz" GZIP;
filename tempxml temp;
data _null_;
rc=fcopy('fromzip','tempxml');
call symputx('temppath',pathname('tempxml'));
run;
filename SXLEMAP "C:\XMLMap\xmlmap.map";libname SXLELIB xml "&temppath" xmlmap=SXLEMAP access=READONLY;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I do not think you can combine the GZIP filename with the XML libname in a meaningful way.
Meaning that you will have to extract the file from the gz archive before assigning it to a libname, e.g.
filename fromzip ZIP "C:\Temp\Folder\data1.xml.gz" GZIP;
filename tempxml temp;
data _null_;
rc=fcopy('fromzip','tempxml');
call symputx('temppath',pathname('tempxml'));
run;
filename SXLEMAP "C:\XMLMap\xmlmap.map";libname SXLELIB xml "&temppath" xmlmap=SXLEMAP access=READONLY;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks @s_lassen !!! This is what something similar I was looking for but without the clue that filerefs can be copied.
Cheers!