<?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 import xml file into sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/import-xml-file-into-sas/m-p/743136#M232589</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May I ask how to import a series of&amp;nbsp; XML files into SAS (the attached is a sample of the XML file)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the two method and got the following results,&lt;/P&gt;&lt;P&gt;first method&lt;/P&gt;&lt;PRE&gt;filename xx temp;
libname xx xmlv2 'F:\USPTOPatentExaminationDataSystem/1960.xml' automap=replace xmlmap=xx;
proc copy in=xx out=xx;
run;&lt;/PRE&gt;&lt;PRE&gt;Result&lt;BR /&gt;1    filename xx temp;
2    libname xx xmlv2 'F:\USPTOPatentExaminationDataSystem/1960.xml' automap=replace xmlmap=xx;
ERROR: The creation of the XML Mapper file failed.
ERROR: Error in the LIBNAME statement.
3    proc copy in=xx out=xx;
NOTE: Writing HTML Body file: sashtml.htm
4    run;

ERROR: Libref XX is not assigned.
NOTE: Statements not processed because of errors noted above.
NOTE: PROCEDURE COPY used (Total process time):
      real time           0.38 seconds
      cpu time            0.28 seconds

NOTE: The SAS System stopped processing this step because of errors.
NOTE: Parsing with high validation.
WARNING: XMLMap parser encountered XML issue
         Exception class: org.xml.sax.SAXParseException
         ID: &amp;lt;null&amp;gt;
         Message: schema_reference.4: Failed to read schema document
'../../main/resources/Schema/USPatent/Document/PatentBulkData_V8_0.xsd', because 1) could not find
the document; 2) the document could not be read; 3) the root element of the document is not
&amp;lt;xsd:schema&amp;gt;.
         Line: 2
         Column: 456


&lt;/PRE&gt;&lt;P&gt;second method&lt;/P&gt;&lt;PRE&gt;libname myxml xml 'F:\USPTOPatentExaminationDataSystem\1960-1979-pairbulk-full-20201213-xml\1960.xml';
libname dat 'I:\Data_in_SAS\USPTO';
data dat.subjects;
 set myxml.subjects;
run;
proc print data = dat.subjects noobs;
run; &lt;/PRE&gt;&lt;P&gt;result&lt;/P&gt;&lt;PRE&gt;12   libname myxml xml 'F:\USPTOPatentExaminationDataSystem/1960.xml';
NOTE: Libref MYXML was successfully assigned as follows:
      Engine:        XML
      Physical Name: F:\USPTOPatentExaminationDataSystem/1960.xml
13   libname dat 'I:\Data_in_SAS\USPTO';
NOTE: Libref DAT was successfully assigned as follows:
      Engine:        V9
      Physical Name: I:\Data_in_SAS\USPTO
14   data dat.subjects;
15    set myxml.subjects;
ERROR: The XML element name &amp;lt;RegisteredPractitionerRegistrationNumber&amp;gt; is too long for a SAS variable
       name.

ERROR: Encountered during XMLMap parsing at or near line 643, column 67.
ERROR: XML describe error: Internal processing error.
16   run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set DAT.SUBJECTS may be incomplete.  When this step was stopped there were 0
         observations and 0 variables.
WARNING: Data set DAT.SUBJECTS was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.05 seconds
      cpu time            0.00 seconds


17   proc print data = dat.subjects noobs;
18   run;

NOTE: No variables in data set DAT.SUBJECTS.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds





&lt;/PRE&gt;&lt;P&gt;Could you please give me some advice about this? Many thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 22 May 2021 15:02:27 GMT</pubDate>
    <dc:creator>Alexxxxxxx</dc:creator>
    <dc:date>2021-05-22T15:02:27Z</dc:date>
    <item>
      <title>import xml file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-xml-file-into-sas/m-p/743136#M232589</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May I ask how to import a series of&amp;nbsp; XML files into SAS (the attached is a sample of the XML file)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the two method and got the following results,&lt;/P&gt;&lt;P&gt;first method&lt;/P&gt;&lt;PRE&gt;filename xx temp;
libname xx xmlv2 'F:\USPTOPatentExaminationDataSystem/1960.xml' automap=replace xmlmap=xx;
proc copy in=xx out=xx;
run;&lt;/PRE&gt;&lt;PRE&gt;Result&lt;BR /&gt;1    filename xx temp;
2    libname xx xmlv2 'F:\USPTOPatentExaminationDataSystem/1960.xml' automap=replace xmlmap=xx;
ERROR: The creation of the XML Mapper file failed.
ERROR: Error in the LIBNAME statement.
3    proc copy in=xx out=xx;
NOTE: Writing HTML Body file: sashtml.htm
4    run;

ERROR: Libref XX is not assigned.
NOTE: Statements not processed because of errors noted above.
NOTE: PROCEDURE COPY used (Total process time):
      real time           0.38 seconds
      cpu time            0.28 seconds

NOTE: The SAS System stopped processing this step because of errors.
NOTE: Parsing with high validation.
WARNING: XMLMap parser encountered XML issue
         Exception class: org.xml.sax.SAXParseException
         ID: &amp;lt;null&amp;gt;
         Message: schema_reference.4: Failed to read schema document
'../../main/resources/Schema/USPatent/Document/PatentBulkData_V8_0.xsd', because 1) could not find
the document; 2) the document could not be read; 3) the root element of the document is not
&amp;lt;xsd:schema&amp;gt;.
         Line: 2
         Column: 456


&lt;/PRE&gt;&lt;P&gt;second method&lt;/P&gt;&lt;PRE&gt;libname myxml xml 'F:\USPTOPatentExaminationDataSystem\1960-1979-pairbulk-full-20201213-xml\1960.xml';
libname dat 'I:\Data_in_SAS\USPTO';
data dat.subjects;
 set myxml.subjects;
run;
proc print data = dat.subjects noobs;
run; &lt;/PRE&gt;&lt;P&gt;result&lt;/P&gt;&lt;PRE&gt;12   libname myxml xml 'F:\USPTOPatentExaminationDataSystem/1960.xml';
NOTE: Libref MYXML was successfully assigned as follows:
      Engine:        XML
      Physical Name: F:\USPTOPatentExaminationDataSystem/1960.xml
13   libname dat 'I:\Data_in_SAS\USPTO';
NOTE: Libref DAT was successfully assigned as follows:
      Engine:        V9
      Physical Name: I:\Data_in_SAS\USPTO
14   data dat.subjects;
15    set myxml.subjects;
ERROR: The XML element name &amp;lt;RegisteredPractitionerRegistrationNumber&amp;gt; is too long for a SAS variable
       name.

ERROR: Encountered during XMLMap parsing at or near line 643, column 67.
ERROR: XML describe error: Internal processing error.
16   run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set DAT.SUBJECTS may be incomplete.  When this step was stopped there were 0
         observations and 0 variables.
WARNING: Data set DAT.SUBJECTS was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.05 seconds
      cpu time            0.00 seconds


17   proc print data = dat.subjects noobs;
18   run;

NOTE: No variables in data set DAT.SUBJECTS.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds





&lt;/PRE&gt;&lt;P&gt;Could you please give me some advice about this? Many thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 May 2021 15:02:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-xml-file-into-sas/m-p/743136#M232589</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2021-05-22T15:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: import xml file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-xml-file-into-sas/m-p/743199#M232620</link>
      <description>&lt;P&gt;Couldn't you simply pre-process the file to change the string "RegisteredPractitionerRegistrationNumber"&amp;nbsp; ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 07:51:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-xml-file-into-sas/m-p/743199#M232620</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-05-23T07:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: import xml file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-xml-file-into-sas/m-p/743205#M232624</link>
      <description>&lt;P&gt;That means your XML file is not correct .&lt;/P&gt;
&lt;P&gt;What do you want to see FROM this xml ?&lt;/P&gt;
&lt;P&gt;Post the table you want to get that would be better .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename x'c:\temp\1960.xml' termstr=lf;
data have;
infile x truncover length=len;
input have $varying2000. len;
if strip(have) =: '&amp;lt;uscom:ApplicationNumberText' then group+1;
want=prxchange('s/\&amp;lt;.+?\&amp;gt;//',-1,have);
if not missing(want);
run;

proc transpose data=have out=want;
by group;
var want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 23 May 2021 10:58:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-xml-file-into-sas/m-p/743205#M232624</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-05-23T10:58:44Z</dc:date>
    </item>
  </channel>
</rss>

