<?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: When exporting to CSV variables are defined by &amp;quot;assigned values&amp;quot; instead of &amp;quot;raw in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/When-exporting-to-CSV-variables-are-defined-by-quot-assigned/m-p/712846#M219837</link>
    <description>&lt;P&gt;You can use the _ALL_ variable list.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=have;
  format _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But watch out for date, time or datetime values.&amp;nbsp; You will get the raw number of days or seconds instead if you remove the formats.&amp;nbsp; You can add a second format statement to re-attach them.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=have;
  format _all_;
  format date yymmdd10. time time5. datetime datetime19.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 20 Jan 2021 19:21:32 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-01-20T19:21:32Z</dc:date>
    <item>
      <title>When exporting to CSV variables are defined by "assigned values" instead of "raw values"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-exporting-to-CSV-variables-are-defined-by-quot-assigned/m-p/712807#M219827</link>
      <description>&lt;P&gt;I am having an issue when exporting a SAS file to a CSV file. Specifically variables are being exported with their "assigned values" instead of their "raw values".&amp;nbsp; For example there is a dichotomous numerical variable with "raw values" of either 0 or 1 with "assigned values" of 0="no", 1="yes". When exporting the SAS file to a CSV this variable includes its "assigned value" ('Yes' or 'No') instead of the "raw value" (0 or 1) . Is their code that helps avoid this? The following is the code used to export the data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC EXPORT DATA=&lt;EM&gt;sas file&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Outfile= &lt;EM&gt;CSV file&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DBMS=csv REPLACE;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PUTNAMES=no;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Run;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Thanks for your help&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 18:05:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-exporting-to-CSV-variables-are-defined-by-quot-assigned/m-p/712807#M219827</guid>
      <dc:creator>FourLeafCLover</dc:creator>
      <dc:date>2021-01-20T18:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: When exporting to CSV variables are defined by "assigned values" instead of "raw</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-exporting-to-CSV-variables-are-defined-by-quot-assigned/m-p/712811#M219829</link>
      <description>&lt;P&gt;Take the data step code (created by PROC EXPORT) from the log and de-assign the formats.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 18:15:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-exporting-to-CSV-variables-are-defined-by-quot-assigned/m-p/712811#M219829</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-20T18:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: When exporting to CSV variables are defined by "assigned values" instead of "raw</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-exporting-to-CSV-variables-are-defined-by-quot-assigned/m-p/712836#M219833</link>
      <description>&lt;P&gt;You have formats applied to your data then.&lt;/P&gt;
&lt;P&gt;You can remove the format ahead of time or apply it as needed to generate the data you want. ODS CSV is a good way to do this as you can easily control the formats within a proc and test it easily.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;ods csv file='/folders/myfolders/demo.csv';
   proc print data=sashelp.class noobs;
   format age 8.2; *formats variable as numeric with 2 decimal places;
   run;
ods csv close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Same answer as here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/65814476/exporting-sas-file-to-csv&amp;nbsp;" target="_blank"&gt;https://stackoverflow.com/questions/65814476/exporting-sas-file-to-csv&amp;nbsp;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 18:59:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-exporting-to-CSV-variables-are-defined-by-quot-assigned/m-p/712836#M219833</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-20T18:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: When exporting to CSV variables are defined by "assigned values" instead of "raw</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-exporting-to-CSV-variables-are-defined-by-quot-assigned/m-p/712839#M219835</link>
      <description>&lt;BR /&gt;&lt;BR /&gt;&amp;lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&amp;gt;&lt;BR /&gt;P {margin-top:0;margin-bottom:0;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;BR /&gt;Thank you Reeza, appreciate the reply. Is there a way to remove formats from all variables without specifying each one? I am having this issue with many variables, not just the one. Thanks&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Jan 2021 19:07:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-exporting-to-CSV-variables-are-defined-by-quot-assigned/m-p/712839#M219835</guid>
      <dc:creator>FourLeafCLover</dc:creator>
      <dc:date>2021-01-20T19:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: When exporting to CSV variables are defined by "assigned values" instead of "raw</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-exporting-to-CSV-variables-are-defined-by-quot-assigned/m-p/712841#M219836</link>
      <description>&lt;BR /&gt;&lt;BR /&gt;&amp;lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&amp;gt;&lt;BR /&gt;P {margin-top:0;margin-bottom:0;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;BR /&gt;Thanks Kurt for the quick reply, I do see the data step in the log after running the proc export. Is there code to be added to this data step that de-assigns all the formats. Thanks&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Jan 2021 19:10:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-exporting-to-CSV-variables-are-defined-by-quot-assigned/m-p/712841#M219836</guid>
      <dc:creator>FourLeafCLover</dc:creator>
      <dc:date>2021-01-20T19:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: When exporting to CSV variables are defined by "assigned values" instead of "raw</title>
      <link>https://communities.sas.com/t5/SAS-Programming/When-exporting-to-CSV-variables-are-defined-by-quot-assigned/m-p/712846#M219837</link>
      <description>&lt;P&gt;You can use the _ALL_ variable list.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=have;
  format _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But watch out for date, time or datetime values.&amp;nbsp; You will get the raw number of days or seconds instead if you remove the formats.&amp;nbsp; You can add a second format statement to re-attach them.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=have;
  format _all_;
  format date yymmdd10. time time5. datetime datetime19.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jan 2021 19:21:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/When-exporting-to-CSV-variables-are-defined-by-quot-assigned/m-p/712846#M219837</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-01-20T19:21:32Z</dc:date>
    </item>
  </channel>
</rss>

