<?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 How do I export data from SAS format files to a CSV? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-data-from-SAS-format-files-to-a-CSV/m-p/697994#M213408</link>
    <description>&lt;P&gt;From a SAS program, I've generated a format file (formats.sas7bcat) that applies values to a given SAS dataset. For the dataset, in a given column, the values will be reformatted. For example, for a column 'PAYMENT' with given values of {'1', '2', '3', '4'} the values will be reformatted to something like {'credit card', 'cash', 'check', 'other'}.&lt;/P&gt;&lt;P&gt;To export the translated dataset I've done:&lt;/P&gt;&lt;P&gt;proc export&lt;/P&gt;&lt;P&gt;data = temp_lib.data1&lt;/P&gt;&lt;P&gt;outfile = /*file location &amp;amp; filename.csv*/&lt;/P&gt;&lt;P&gt;label&lt;/P&gt;&lt;P&gt;dbms = CSV&lt;/P&gt;&lt;P&gt;replace;&lt;/P&gt;&lt;P&gt;putnames = yes;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 100+ formats. Instead of exporting the translated datasets, how would I go about exporting only the formats to a csv file? Something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;variable,&amp;nbsp; value, label&lt;/P&gt;&lt;P&gt;PAYMENT, 1, 1='credit card'&lt;/P&gt;&lt;P&gt;PAYMENT, 2, 2='cash'&lt;/P&gt;&lt;P&gt;PAYMENT, 3, 3='check'&lt;/P&gt;&lt;P&gt;PAYMENT, 4, 4='other'&lt;/P&gt;&lt;P&gt;other variable, other value, other label...&lt;/P&gt;</description>
    <pubDate>Tue, 10 Nov 2020 20:41:09 GMT</pubDate>
    <dc:creator>Peter_I_SAS00</dc:creator>
    <dc:date>2020-11-10T20:41:09Z</dc:date>
    <item>
      <title>How do I export data from SAS format files to a CSV?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-data-from-SAS-format-files-to-a-CSV/m-p/697994#M213408</link>
      <description>&lt;P&gt;From a SAS program, I've generated a format file (formats.sas7bcat) that applies values to a given SAS dataset. For the dataset, in a given column, the values will be reformatted. For example, for a column 'PAYMENT' with given values of {'1', '2', '3', '4'} the values will be reformatted to something like {'credit card', 'cash', 'check', 'other'}.&lt;/P&gt;&lt;P&gt;To export the translated dataset I've done:&lt;/P&gt;&lt;P&gt;proc export&lt;/P&gt;&lt;P&gt;data = temp_lib.data1&lt;/P&gt;&lt;P&gt;outfile = /*file location &amp;amp; filename.csv*/&lt;/P&gt;&lt;P&gt;label&lt;/P&gt;&lt;P&gt;dbms = CSV&lt;/P&gt;&lt;P&gt;replace;&lt;/P&gt;&lt;P&gt;putnames = yes;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 100+ formats. Instead of exporting the translated datasets, how would I go about exporting only the formats to a csv file? Something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;variable,&amp;nbsp; value, label&lt;/P&gt;&lt;P&gt;PAYMENT, 1, 1='credit card'&lt;/P&gt;&lt;P&gt;PAYMENT, 2, 2='cash'&lt;/P&gt;&lt;P&gt;PAYMENT, 3, 3='check'&lt;/P&gt;&lt;P&gt;PAYMENT, 4, 4='other'&lt;/P&gt;&lt;P&gt;other variable, other value, other label...&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2020 20:41:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-data-from-SAS-format-files-to-a-CSV/m-p/697994#M213408</guid>
      <dc:creator>Peter_I_SAS00</dc:creator>
      <dc:date>2020-11-10T20:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export data from SAS format files to a CSV?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-data-from-SAS-format-files-to-a-CSV/m-p/697995#M213409</link>
      <description>&lt;P&gt;Pipe them to a data set? That same data set can then be imported back in&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*pipe data to a file;
proc format cntlout = myFormats;
run;

proc export data=myFormats outfile='/folders/myfolders/myFOrmats.csv' dbms=csv replace;run;


*to recreate the formats from the data set;
proc format cntlin = myformats;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/356485"&gt;@Peter_I_SAS00&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;From a SAS program, I've generated a format file (formats.sas7bcat) that applies values to a given SAS dataset. For the dataset, in a given column, the values will be reformatted. For example, for a column 'PAYMENT' with given values of {'1', '2', '3', '4'} the values will be reformatted to something like {'credit card', 'cash', 'check', 'other'}.&lt;/P&gt;
&lt;P&gt;To export the translated dataset I've done:&lt;/P&gt;
&lt;P&gt;proc export&lt;/P&gt;
&lt;P&gt;data = temp_lib.data1&lt;/P&gt;
&lt;P&gt;outfile = /*file location &amp;amp; filename.csv*/&lt;/P&gt;
&lt;P&gt;label&lt;/P&gt;
&lt;P&gt;dbms = CSV&lt;/P&gt;
&lt;P&gt;replace;&lt;/P&gt;
&lt;P&gt;putnames = yes;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have 100+ formats. Instead of exporting the translated datasets, how would I go about exporting only the formats to a csv file? Something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;variable,&amp;nbsp; value, label&lt;/P&gt;
&lt;P&gt;PAYMENT, 1, 1='credit card'&lt;/P&gt;
&lt;P&gt;PAYMENT, 2, 2='cash'&lt;/P&gt;
&lt;P&gt;PAYMENT, 3, 3='check'&lt;/P&gt;
&lt;P&gt;PAYMENT, 4, 4='other'&lt;/P&gt;
&lt;P&gt;other variable, other value, other label...&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2020 20:44:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-data-from-SAS-format-files-to-a-CSV/m-p/697995#M213409</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-11-10T20:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I export data from SAS format files to a CSV?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-data-from-SAS-format-files-to-a-CSV/m-p/698013#M213421</link>
      <description>&lt;P&gt;You may want to consider learning about the proc fromat CNTLOUT option to create a data set from the definitions. The output data set would have the format name, the start and end values(for ranges) and the value label plus some other stuff like whether it is a character value, multilabel, informat (invalue) or format, has an "other" range defined and such.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your target CSV is also missing something unless you have 1) absolutely no formats with ranges of values (missing one end of the range) or 2) no formats for missing values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2020 21:26:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-export-data-from-SAS-format-files-to-a-CSV/m-p/698013#M213421</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-11-10T21:26:52Z</dc:date>
    </item>
  </channel>
</rss>

