<?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 Utility macro for reading XPORT files in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Utility-macro-for-reading-XPORT-files/m-p/904167#M357235</link>
    <description>&lt;P&gt;There have been a number of posts on SAS Communities from users having trouble with converting XPORT files they have received.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Binary zeros in FORMAT/INFORMAT names.&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/New-SAS-User/transporting-files-from-R-to-SAS/td-p/898017" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/New-SAS-User/transporting-files-from-R-to-SAS/td-p/898017&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reading directly from ZIP file.&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Cannot-import-XPT-file-into-SAS/td-p/668444" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/Cannot-import-XPT-file-into-SAS/td-p/668444&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Empty dataset issue&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/New-SAS-User/SAS-Xport-Empty-Data-Set-File-Issue/td-p/765019" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/New-SAS-User/SAS-Xport-Empty-Data-Set-File-Issue/td-p/765019&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To help with reading such files I have created an %XPORT2SAS() macro.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/sasutils/macros/blob/master/xport2sas.sas" target="_blank" rel="noopener"&gt;https://github.com/sasutils/macros/blob/master/xport2sas.sas&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Enhancements over XPT2LOC macro include:&lt;BR /&gt;- Detects and adapts to CPORT files.&lt;BR /&gt;- Handles zero variable and zero observation datasets.&lt;BR /&gt;- Handles extra LIBRARY records when reading multiple XPORT files together.&lt;BR /&gt;- Handles some file format errors generated by third party software.&lt;BR /&gt;&amp;nbsp; &amp;nbsp; - Invalid format specifications in LABELV9 records.&lt;BR /&gt;&amp;nbsp; &amp;nbsp; - Binary zeros in character fields.&lt;BR /&gt;- Allows forcing file to be read using RECFM=F.&lt;BR /&gt;&amp;nbsp; &amp;nbsp;- Needed when RECFM=N does not work properly.&lt;BR /&gt;&amp;nbsp; &amp;nbsp;- RECFM=F code will not conflict with any dataset variable names.&lt;BR /&gt;- Includes macro parameter validation.&lt;BR /&gt;- Allows saving metadata to a dataset.&lt;BR /&gt;- Allows saving generated code to a file.&lt;BR /&gt;- Uses system generated fileref names to avoid conflicts.&lt;BR /&gt;- Allows nliteral memnames in MEMLIST parameter.&lt;BR /&gt;- All code contained in single macro.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please try it out and let me know if you find any issues with the code.&amp;nbsp; Or have examples of XPORT files that have issues it cannot handle.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am particularly interested in whether RECFM=N can be used to read from an XPORT file on MVS.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Nov 2023 23:25:33 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-11-21T23:25:33Z</dc:date>
    <item>
      <title>Utility macro for reading XPORT files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Utility-macro-for-reading-XPORT-files/m-p/904167#M357235</link>
      <description>&lt;P&gt;There have been a number of posts on SAS Communities from users having trouble with converting XPORT files they have received.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Binary zeros in FORMAT/INFORMAT names.&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/New-SAS-User/transporting-files-from-R-to-SAS/td-p/898017" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/New-SAS-User/transporting-files-from-R-to-SAS/td-p/898017&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reading directly from ZIP file.&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Cannot-import-XPT-file-into-SAS/td-p/668444" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/Cannot-import-XPT-file-into-SAS/td-p/668444&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Empty dataset issue&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/New-SAS-User/SAS-Xport-Empty-Data-Set-File-Issue/td-p/765019" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/New-SAS-User/SAS-Xport-Empty-Data-Set-File-Issue/td-p/765019&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To help with reading such files I have created an %XPORT2SAS() macro.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/sasutils/macros/blob/master/xport2sas.sas" target="_blank" rel="noopener"&gt;https://github.com/sasutils/macros/blob/master/xport2sas.sas&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Enhancements over XPT2LOC macro include:&lt;BR /&gt;- Detects and adapts to CPORT files.&lt;BR /&gt;- Handles zero variable and zero observation datasets.&lt;BR /&gt;- Handles extra LIBRARY records when reading multiple XPORT files together.&lt;BR /&gt;- Handles some file format errors generated by third party software.&lt;BR /&gt;&amp;nbsp; &amp;nbsp; - Invalid format specifications in LABELV9 records.&lt;BR /&gt;&amp;nbsp; &amp;nbsp; - Binary zeros in character fields.&lt;BR /&gt;- Allows forcing file to be read using RECFM=F.&lt;BR /&gt;&amp;nbsp; &amp;nbsp;- Needed when RECFM=N does not work properly.&lt;BR /&gt;&amp;nbsp; &amp;nbsp;- RECFM=F code will not conflict with any dataset variable names.&lt;BR /&gt;- Includes macro parameter validation.&lt;BR /&gt;- Allows saving metadata to a dataset.&lt;BR /&gt;- Allows saving generated code to a file.&lt;BR /&gt;- Uses system generated fileref names to avoid conflicts.&lt;BR /&gt;- Allows nliteral memnames in MEMLIST parameter.&lt;BR /&gt;- All code contained in single macro.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please try it out and let me know if you find any issues with the code.&amp;nbsp; Or have examples of XPORT files that have issues it cannot handle.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am particularly interested in whether RECFM=N can be used to read from an XPORT file on MVS.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 23:25:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Utility-macro-for-reading-XPORT-files/m-p/904167#M357235</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-11-21T23:25:33Z</dc:date>
    </item>
  </channel>
</rss>

