<?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 Export SAS Numeric Characters to CSV in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Export-SAS-Numeric-Characters-to-CSV/m-p/46633#M12447</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am exporting from SAS to Excel (CSV).&amp;nbsp; I have three-digit subject numbers such as 001, 002, 003, etc.&amp;nbsp; When I run the PROC EXPORT, I get 1, 2, 3, etc. for that field.&amp;nbsp; Is there an option I can specify to keep it as a three-digit character string in Excel?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Feb 2012 15:20:05 GMT</pubDate>
    <dc:creator>djbateman</dc:creator>
    <dc:date>2012-02-06T15:20:05Z</dc:date>
    <item>
      <title>Export SAS Numeric Characters to CSV</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Export-SAS-Numeric-Characters-to-CSV/m-p/46633#M12447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am exporting from SAS to Excel (CSV).&amp;nbsp; I have three-digit subject numbers such as 001, 002, 003, etc.&amp;nbsp; When I run the PROC EXPORT, I get 1, 2, 3, etc. for that field.&amp;nbsp; Is there an option I can specify to keep it as a three-digit character string in Excel?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 15:20:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Export-SAS-Numeric-Characters-to-CSV/m-p/46633#M12447</guid>
      <dc:creator>djbateman</dc:creator>
      <dc:date>2012-02-06T15:20:05Z</dc:date>
    </item>
    <item>
      <title>Export SAS Numeric Characters to CSV</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Export-SAS-Numeric-Characters-to-CSV/m-p/46634#M12448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Short answer, NO.&amp;nbsp; CSV files are just text files.&amp;nbsp; It is Excel that is "eating" the leading zeros.&lt;/P&gt;&lt;P&gt;Long answer, There are a few methods that help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For occasional use change the way that you are opening the file in Excel so that you get the option screens that let you tell it the column is character even though the values look like numbers.&amp;nbsp; The easist way to get Excel to prompt you is to not use .csv as the file extension.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are other ways of exporting to Excel, such as using ODS tagsets.EXCELXP, that give you control over the format of the cells.&amp;nbsp; But then they are not CSV files and so can not be read by programs other than Excel.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 16:14:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Export-SAS-Numeric-Characters-to-CSV/m-p/46634#M12448</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-02-06T16:14:45Z</dc:date>
    </item>
    <item>
      <title>Export SAS Numeric Characters to CSV</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Export-SAS-Numeric-Characters-to-CSV/m-p/46635#M12449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;before you export to .csv, add a single quote to the front of the numerics you want to keep as a character string, e.g. '001, '002, '003&lt;/P&gt;&lt;P&gt;Excel should interpret the beginning single quote as a text field marker.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 16:41:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Export-SAS-Numeric-Characters-to-CSV/m-p/46635#M12449</guid>
      <dc:creator>ChuckMoore</dc:creator>
      <dc:date>2012-02-06T16:41:24Z</dc:date>
    </item>
    <item>
      <title>Export SAS Numeric Characters to CSV</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Export-SAS-Numeric-Characters-to-CSV/m-p/46636#M12450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; This exports the data as '001, '002, etc.&amp;nbsp; I am able to click on the first cell, hit enter, and it removes the apostraphe.&amp;nbsp; Then, I drag down.&amp;nbsp; It works, but it is not automatic.&amp;nbsp; Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 17:37:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Export-SAS-Numeric-Characters-to-CSV/m-p/46636#M12450</guid>
      <dc:creator>djbateman</dc:creator>
      <dc:date>2012-02-06T17:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: Export SAS Numeric Characters to CSV</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Export-SAS-Numeric-Characters-to-CSV/m-p/46637#M12451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ... if the eventual destination is Excel, do you need the intervening CSV file or can you go to Excel directly ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;data x;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;input x1-x3;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;datalines;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;1 2 3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;10 20 30&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;100 200 300&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;ods listing close;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;ods results off;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;ods msoffice2k file='z:\test.xls' ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;proc print data=x noobs;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;var x1-x3 / style={htmlstyle="mso-number-format:'00000'"};&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;ods msoffice2k close;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;ods results;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;ods listing;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;screen capture of TEXT.XLS is attached&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11004iC528DAE023CDCEFD/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="test.png" title="test.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 19:07:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Export-SAS-Numeric-Characters-to-CSV/m-p/46637#M12451</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2012-02-06T19:07:21Z</dc:date>
    </item>
    <item>
      <title>Export SAS Numeric Characters to CSV</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Export-SAS-Numeric-Characters-to-CSV/m-p/46638#M12452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I need the CSV format.&amp;nbsp; I also have a few cases where the ID needs to be 4 digits long, so I don't know that I would be able to use an if statement to make sure that your method placed 4 digits vs. 3 digits when needed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 19:15:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Export-SAS-Numeric-Characters-to-CSV/m-p/46638#M12452</guid>
      <dc:creator>djbateman</dc:creator>
      <dc:date>2012-02-06T19:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: Export SAS Numeric Characters to CSV</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Export-SAS-Numeric-Characters-to-CSV/m-p/46639#M12453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ... the varying length is not an issue (not sure what you mean about "use an IF statement") ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;data x;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;input x1-x3;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;datalines;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;1 10 100&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;2 20 200&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;3 30 300&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;ods listing close;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;ods results off;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;ods msoffice2k file='z:\test.xls';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;proc print data=x noobs;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;var x1 / style={htmlstyle="mso-number-format:'00'"};&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;var x2 / style={htmlstyle="mso-number-format:'000'"};&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;var x3 / style={htmlstyle="mso-number-format:'0000'"};&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;ods msoffice2k close;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;ods results;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;ods listing;&lt;/STRONG&gt;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10641iD2C69F69093CBF44/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="test.png" title="test.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 19:23:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Export-SAS-Numeric-Characters-to-CSV/m-p/46639#M12453</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2012-02-06T19:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Export SAS Numeric Characters to CSV</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Export-SAS-Numeric-Characters-to-CSV/m-p/46640#M12454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another way to keep the leading zeros is to create a tagset based on the CSVALL tagset.&amp;nbsp; Below is an example of one I created based on an example from Chevell Parker (&lt;A href="http://www2.sas.com/proceedings/sugi28/012-28.pdf"&gt;http://www2.sas.com/proceedings/sugi28/012-28.pdf&lt;/A&gt;).&amp;nbsp;&amp;nbsp;&amp;nbsp; ﻿&lt;/P&gt;&lt;P&gt;PROC TEMPLATE; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DEFINE tagset Tagsets.CSVDownload; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parent=tagsets.CSVALL; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DEFINE event data; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PUT "," / if !cmp(COLSTART , "1"); &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PUT '=' """" / if cmp( TYPE ,"string"); &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PUT VALUE; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PUT """" / if cmp( TYPE , "string"); &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END; &lt;/P&gt;&lt;P&gt;RUN; &lt;/P&gt;&lt;P&gt;%LET RV=%SYSFUNC(APPSRV_HEADER(CONTENT-TYPE,TEXT/CSV)); &lt;/P&gt;&lt;P&gt;ODS markup BODY=_webout tagset=﻿﻿Tagsets.CSVDownload;﻿﻿﻿&lt;/P&gt;&lt;P&gt;%LET RV=%SYSFUNC(APPSRV_HEADER(CONTENT-DISPOSITION,%STR(ATTACHMENT;FILENAME="DownLoad.csv")));&lt;/P&gt;&lt;P&gt;proc print data=one; &lt;/P&gt;&lt;P&gt;RUN; &lt;/P&gt;&lt;P&gt;ODS markup close;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 20:53:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Export-SAS-Numeric-Characters-to-CSV/m-p/46640#M12454</guid>
      <dc:creator>TG_WPAFB</dc:creator>
      <dc:date>2012-02-06T20:53:12Z</dc:date>
    </item>
  </channel>
</rss>

