<?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 Hold the 0 while proc export in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Hold-the-0-while-proc-export/m-p/835780#M330442</link>
    <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;The values in my data is :&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASdevAnneMarie_1-1664439541859.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75701iC261DD3810A550B3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASdevAnneMarie_1-1664439541859.png" alt="SASdevAnneMarie_1-1664439541859.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I export (proc export)&amp;nbsp; this values to a csv file I don't have the 0 anymore :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASdevAnneMarie_2-1664439572101.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75702iE82AB0289D5C4F22/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASdevAnneMarie_2-1664439572101.png" alt="SASdevAnneMarie_2-1664439572101.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you know, please, how to hold the 0 while exportation ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help&amp;nbsp; !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Sep 2022 08:22:39 GMT</pubDate>
    <dc:creator>SASdevAnneMarie</dc:creator>
    <dc:date>2022-09-29T08:22:39Z</dc:date>
    <item>
      <title>Hold the 0 while proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hold-the-0-while-proc-export/m-p/835780#M330442</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;The values in my data is :&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASdevAnneMarie_1-1664439541859.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75701iC261DD3810A550B3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASdevAnneMarie_1-1664439541859.png" alt="SASdevAnneMarie_1-1664439541859.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I export (proc export)&amp;nbsp; this values to a csv file I don't have the 0 anymore :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASdevAnneMarie_2-1664439572101.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75702iE82AB0289D5C4F22/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASdevAnneMarie_2-1664439572101.png" alt="SASdevAnneMarie_2-1664439572101.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you know, please, how to hold the 0 while exportation ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help&amp;nbsp; !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 08:22:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hold-the-0-while-proc-export/m-p/835780#M330442</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2022-09-29T08:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: Hold the 0 while proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hold-the-0-while-proc-export/m-p/835791#M330451</link>
      <description>&lt;P&gt;Please do NOT post data as pictures. NEVER. Use a data step with datalines, so we can recreate your data with copy/paste and submit, without having to ask questions about data types and attributes.&lt;/P&gt;
&lt;P&gt;Next, NEVER inspect a csv file with Excel. You see what Excel&amp;nbsp;&lt;EM&gt;thinks&lt;/EM&gt;, not what is really contained in the file. Use a proper text editor like Notepad++.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 09:08:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hold-the-0-while-proc-export/m-p/835791#M330451</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-09-29T09:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: Hold the 0 while proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hold-the-0-while-proc-export/m-p/835861#M330480</link>
      <description>&lt;P&gt;What file format did you export it to?&lt;/P&gt;
&lt;P&gt;What program are you using to look at the exported data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Spreadsheets will typically make decisions about values. So if you create a CSV file and open with a spread sheet then the values are considered numeric and the &lt;STRONG&gt;SPREADSHEET &lt;/STRONG&gt;removes the leading zeroes. (Warning: if you SAVE the file after opening with the spreadsheet then it &lt;STRONG&gt;will change values&lt;/STRONG&gt; permanently.) So open the file in text reading program like NotePad, WordPad or similar.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best is to always show the code you used when asking any questions about the result. Copy the text from your&amp;nbsp; editor or log, on the forum open a text box with the &amp;lt;/&amp;gt; icon and paste the text. Best is often the log as it will include notes about execution results.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 14:42:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hold-the-0-while-proc-export/m-p/835861#M330480</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-09-29T14:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Hold the 0 while proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hold-the-0-while-proc-export/m-p/835865#M330483</link>
      <description>&lt;P&gt;Please show what the CSV file looks like.&amp;nbsp; You posted a photograph of something that looks like a table. A CSV file is a text file.&amp;nbsp; So a CSV file is going to look like TEXT, not like a table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your CSV file should look something like:&lt;/P&gt;
&lt;PRE&gt;var1,var2
0214,953
0214,553
0212,419
0213,942&lt;/PRE&gt;
&lt;P&gt;If you cannot figure out how to look at the CSV file, then just ask SAS to show it to you.&amp;nbsp; So if you exported to a file named myfile.csv then run this simple program to dump the first 10 lines from that file to the SAS log so you can look at it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile 'myfile.csv' obs=10;
  input;
  put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Sep 2022 14:54:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hold-the-0-while-proc-export/m-p/835865#M330483</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-09-29T14:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Hold the 0 while proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hold-the-0-while-proc-export/m-p/835922#M330507</link>
      <description>&lt;P&gt;To confirm the absence of leading zeroes, did you read the CSV file with a text editor?&amp;nbsp; If you did it with Excel, they would not appear even if the csv file has them.&amp;nbsp; If your SAS variable is a character variable (variable &lt;EM&gt;&lt;STRONG&gt;CHRX&lt;/STRONG&gt;&lt;/EM&gt; below), or is a numeric variable with an assigned format specifying leading zeroes (&lt;EM&gt;&lt;STRONG&gt;FX&lt;/STRONG&gt;&lt;/EM&gt; below), then exporting to a CSV file (i.e. "dbms=csv") will preserve leading zeroes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  do x=1,22,333,4444;
    ; fx=1;  chrx=put(x,z4.);
    format fx z4.;
    output;
    put (_all_) (=); 
  end;
run;
proc export data=have 
  outfile='c:\temp\x.csv' replace
  dbms=csv;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This program produces the x.csv file in the c:\temp directory.&amp;nbsp; Examine it with NOTEPAD or some other ascii editor to confirm preservation of leading zeroes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 19:08:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hold-the-0-while-proc-export/m-p/835922#M330507</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-09-29T19:08:15Z</dc:date>
    </item>
  </channel>
</rss>

