<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: can't view sas data sets from xml files in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/can-t-view-sas-data-sets-from-xml-files/m-p/412400#M100868</link>
    <description>&lt;P&gt;&amp;gt;&lt;SPAN&gt;&amp;nbsp;I can't view the datasets in sas to start working with the data.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What does that mean? Post your log instead.&lt;/P&gt;</description>
    <pubDate>Fri, 10 Nov 2017 15:59:09 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-11-10T15:59:09Z</dc:date>
    <item>
      <title>can't view sas data sets from xml files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-t-view-sas-data-sets-from-xml-files/m-p/412337#M100844</link>
      <description>&lt;P&gt;I have a map that works with my xml files and I managed to process all of them with xmlmap and get all proc contents for them but I can't view the datasets in sas to start working with the data. I attach one of the xml files as an example&amp;nbsp; . Could someone please help? Thanks in advance.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
filename  SXLELIB '\\tsclient\C\Transferencia de Archivos\IMPORT TO SAS\SIAM\02303_20171015132340.xml';
filename  SXLEMAP '\\tsclient\C\Transferencia de Archivos\IMPORT TO SAS\SIAM\siammapV2.map';
libname   SXLELIB xmlv2 xmlmap=SXLEMAP access=READONLY;

/*
 *  Catalog
 */

proc datasets lib=SXLELIB; run;

/*
 *  Contents
 */

proc contents data=SXLELIB.alerta varnum; run;

 *  Printing
 */

title 'Table alerta';
proc print data=SXLELIB.alerta; run;
title;

/*
 *  Local Extraction
 */

DATA alerta; SET SXLELIB.alerta; run;


filename prueba  pipe 'dir "\\tsclient\C\Transferencia de Archivos\IMPORT TO SAS\siam\*.xml" /b';

data file_list; 
length fname $20; 
infile prueba truncover; /* infile statement for file names */
input fname $20.; /* read the file names from the directory */
call symput ('num_files',_n_); /* store the record number in a macro variable */
run; 


%macro fileread; 
%do j=1 %to &amp;amp;num_files; 

data _null_; 
set file_list; 
if _n_=&amp;amp;j; 
call symput ('filein',fname); 
run; 



filename  SXLELIB "\\tsclient\C\Transferencia de Archivos\IMPORT TO SAS\SIAM\&amp;amp;filein..xml";
filename  SXLEMAP '\\tsclient\C\Transferencia de Archivos\IMPORT TO SAS\SIAM\siammapV2.map';
libname   SXLELIB xmlv2 xmlmap=SXLEMAP access=READONLY;

 
proc datasets lib=SXLELIB; run;

proc contents data=sxlelib._all_ varnum; run;




%end; /* end of do-loop with index j */
%mend fileread; 
%fileread; 


proc copy in=sxlelib out=work;
run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 14:14:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-t-view-sas-data-sets-from-xml-files/m-p/412337#M100844</guid>
      <dc:creator>vanmon1</dc:creator>
      <dc:date>2017-11-10T14:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: can't view sas data sets from xml files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-t-view-sas-data-sets-from-xml-files/m-p/412400#M100868</link>
      <description>&lt;P&gt;&amp;gt;&lt;SPAN&gt;&amp;nbsp;I can't view the datasets in sas to start working with the data.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What does that mean? Post your log instead.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 15:59:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-t-view-sas-data-sets-from-xml-files/m-p/412400#M100868</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-10T15:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: can't view sas data sets from xml files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-t-view-sas-data-sets-from-xml-files/m-p/412517#M100892</link>
      <description>&lt;P&gt;Thanks for your interest. I'm trying with 4 xml files but have hundreds to import.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 22:09:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-t-view-sas-data-sets-from-xml-files/m-p/412517#M100892</guid>
      <dc:creator>vanmon1</dc:creator>
      <dc:date>2017-11-10T22:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: can't view sas data sets from xml files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-t-view-sas-data-sets-from-xml-files/m-p/412519#M100893</link>
      <description>&lt;P&gt;I also attach the output. Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 22:13:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-t-view-sas-data-sets-from-xml-files/m-p/412519#M100893</guid>
      <dc:creator>vanmon1</dc:creator>
      <dc:date>2017-11-10T22:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: can't view sas data sets from xml files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-t-view-sas-data-sets-from-xml-files/m-p/412522#M100894</link>
      <description>&lt;P&gt;Forget the macro for now, do you have a process to read a single file working and imported data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't actually see any steps (PROC COPY?) where you try to store the data...the first attempt seems to work fine but it's hard to follow. I won't have time to test anything until later but wanted to make sure I understand where you're currently at.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 22:25:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-t-view-sas-data-sets-from-xml-files/m-p/412522#M100894</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-10T22:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: can't view sas data sets from xml files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-t-view-sas-data-sets-from-xml-files/m-p/412585#M100899</link>
      <description>&lt;P&gt;Ok, now because of your question I realised I placed proc copy outside the macro so I changed my code and now I can see one resulting dataset in work library, but only one, the last file generated. I supose that's because they all get the same name 'alerta' given in sas xml mapper application and the next dataset overwrites the previous one.. how can I change that and see all of them? Your help is being much appreciated.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename prueba  pipe 'dir "\\tsclient\C\Transferencia de Archivos\IMPORT TO SAS\siam\*.xml" /b';

data file_list; 
length fname $20; 
infile prueba truncover; /* infile statement for file names */
input fname $20.; /* read the file names from the directory */
call symput ('num_files',_n_); /* store the record number in a macro variable */
run; 


%macro fileread; 
%do j=1 %to &amp;amp;num_files; 

data _null_; 
set file_list; 
if _n_=&amp;amp;j; 
call symput ('filein',fname); 
run; 



filename  SXLELIB "\\tsclient\C\Transferencia de Archivos\IMPORT TO SAS\SIAM\&amp;amp;filein..xml";
filename  SXLEMAP '\\tsclient\C\Transferencia de Archivos\IMPORT TO SAS\SIAM\siammapV2.map';
libname   SXLELIB xmlv2 xmlmap=SXLEMAP ;

 
proc datasets lib=SXLELIB; run;

proc contents data=sxlelib._all_ varnum; run;



proc copy in=sxlelib out=work;
run;


%end; /* end of do-loop with index j */
%mend fileread; 
%fileread; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2017 16:08:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-t-view-sas-data-sets-from-xml-files/m-p/412585#M100899</guid>
      <dc:creator>vanmon1</dc:creator>
      <dc:date>2017-11-11T16:08:56Z</dc:date>
    </item>
    <item>
      <title>IMPORT MULTIPLE XML FILES to ONE SAS DATASET USING XML MAPPER TO CREATE THE XML MAP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-t-view-sas-data-sets-from-xml-files/m-p/412599#M100907</link>
      <description>&lt;P&gt;GOT IT! Partly thanks to "A Macro for Reading Multiple Text Files"&amp;nbsp; by Debbie Miller, National Park Service, Denver, CO " and user Reeza who made a question that made me think about one piece of my code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*libname root created by xml mapper*/

libname   SXLELIB xmlv2 xmlmap=SXLEMAP access=READONLY;

/*create macro to read all file names in folder*/
filename prueba  pipe 'dir "\\tsclient\C\Transferencia de Archivos\IMPORT TO SAS\siam\*.xml" /b';

data file_list; 
length fname $20; 
infile prueba truncover; /* infile statement for file names */
input fname $20.; /* read the file names from the directory */
call symput ('num_files',_n_); /* store the record number in a macro variable */
run; 


%macro fileread; 
%do j=1 %to &amp;amp;num_files; 

data _null_; 
set file_list; 
if _n_=&amp;amp;j; 
call symput ('filein',fname); 
run; 


/*code to retrieve xml map created*/
filename  SXLELIB "\\tsclient\C\Transferencia de Archivos\IMPORT TO SAS\SIAM\&amp;amp;filein..xml";
filename  SXLEMAP '\\tsclient\C\Transferencia de Archivos\IMPORT TO SAS\SIAM\siammapv2.map';
libname   SXLELIB xmlv2 xmlmap=SXLEMAP access=READONLY ;

 
proc datasets lib=SXLELIB; run;

proc contents data=sxlelib._all_ varnum; run;

/*copy sxlelib to your library*/

proc copy in=sxlelib out=work;
run;

/*save each file read named 'alerta' as in xml mapper in a single sas dataset call data_all*/
%if &amp;amp;j=1 %then %do;
 data data_all;
 set alerta;
 run;
%end;
%else %do;
 data data_all;
 set data_all
 alerta;
 run;
%end;


%end; 
%mend fileread; 
%fileread; 

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 11 Nov 2017 19:40:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-t-view-sas-data-sets-from-xml-files/m-p/412599#M100907</guid>
      <dc:creator>vanmon1</dc:creator>
      <dc:date>2017-11-11T19:40:18Z</dc:date>
    </item>
  </channel>
</rss>

