<?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 convert multiple xpt files inti sas datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/convert-multiple-xpt-files-inti-sas-datasets/m-p/321478#M71003</link>
    <description>&lt;P&gt;I have a folder in sas studio with multiple xpt files.How to convert it into sas datasets?I can do it choosing each file in to a dataset but how to make it dynamic?&lt;/P&gt;</description>
    <pubDate>Wed, 28 Dec 2016 20:43:54 GMT</pubDate>
    <dc:creator>paddyb</dc:creator>
    <dc:date>2016-12-28T20:43:54Z</dc:date>
    <item>
      <title>convert multiple xpt files inti sas datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-multiple-xpt-files-inti-sas-datasets/m-p/321478#M71003</link>
      <description>&lt;P&gt;I have a folder in sas studio with multiple xpt files.How to convert it into sas datasets?I can do it choosing each file in to a dataset but how to make it dynamic?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2016 20:43:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-multiple-xpt-files-inti-sas-datasets/m-p/321478#M71003</guid>
      <dc:creator>paddyb</dc:creator>
      <dc:date>2016-12-28T20:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: convert multiple xpt files inti sas datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-multiple-xpt-files-inti-sas-datasets/m-p/321491#M71007</link>
      <description>&lt;P&gt;Start by getting the import for one file working properly first. Here is a link to the CIMPORT procedure to get you started:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/proc/69850/HTML/default/viewer.htm#p1be86uw07acoin1aodzspbmkg8m.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/69850/HTML/default/viewer.htm#p1be86uw07acoin1aodzspbmkg8m.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A dynamic solution will most likely involve building a macro.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2016 22:06:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-multiple-xpt-files-inti-sas-datasets/m-p/321491#M71007</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2016-12-28T22:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: convert multiple xpt files inti sas datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-multiple-xpt-files-inti-sas-datasets/m-p/322072#M71214</link>
      <description>&lt;P&gt;libname xylib xport "/home/p0/AM2/data/agxpt/*.xpt ";&lt;BR /&gt;proc copy in=xylib out=work;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;I tried this to convert all xpt files frm agxpt folder but only 4 files i see converted into dataset.Folder have 7 files.Any idea why?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 06:28:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-multiple-xpt-files-inti-sas-datasets/m-p/322072#M71214</guid>
      <dc:creator>paddyb</dc:creator>
      <dc:date>2017-01-03T06:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: convert multiple xpt files inti sas datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-multiple-xpt-files-inti-sas-datasets/m-p/491820#M129087</link>
      <description>&lt;P&gt;this didn't work when i am trying to extract multiple XPT files to SAS files.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Sep 2018 12:03:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-multiple-xpt-files-inti-sas-datasets/m-p/491820#M129087</guid>
      <dc:creator>Bhavanaa</dc:creator>
      <dc:date>2018-09-01T12:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: convert multiple xpt files inti sas datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-multiple-xpt-files-inti-sas-datasets/m-p/491825#M129092</link>
      <description>&lt;P&gt;The XPORT engine works on a single file.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Sep 2018 15:31:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-multiple-xpt-files-inti-sas-datasets/m-p/491825#M129092</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-01T15:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: convert multiple xpt files inti sas datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-multiple-xpt-files-inti-sas-datasets/m-p/491831#M129098</link>
      <description>&lt;P&gt;Step one figure out if your XPT files are SAS V5 transport files, CPORT files or possibly the new V7 transport files that require using the SAS published macro to read.&amp;nbsp; Then get the code to convert one file.&amp;nbsp; So for a V5 transport file the code copy all of the dataset that are in the transport file to SAS datasets would look like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname out "path";
libname in xport "filename";
proc copy inlib=in outlib=out;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Where filename is the name of the XPT file and path is the directory where you want to write the files. To copy them as work datasets skip the&amp;nbsp;first libname statement and just use WORK as the outlib in the proc copy step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the file was generated by PROC CPORT then you need to generate a PROC CIMPORT step instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now get a list of the files.&amp;nbsp; There are tons of posts on this site for how to do that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then either use the list to generate the LIBNAME,PROC COPY steps.&amp;nbsp; For example if your list of filenames is in a data set named FILES and the variable with the filename is named FILENAME then that code could look like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename code temp;
data _null_;
  set files ;
  file code ;
  put
  'libname in xport ' filename :$quote. ';'
/ 'proc copy inlib=in outlib=out; run; '
  ;
run;
%include code / source2 ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you could create a little macro to do one file and generate the code to call the macro.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Sep 2018 16:45:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-multiple-xpt-files-inti-sas-datasets/m-p/491831#M129098</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-01T16:45:23Z</dc:date>
    </item>
  </channel>
</rss>

