SAS Office Analytics, SAS Add-In for Microsoft Office, and other integrations

Problem exporting numeric data to Excel

Occasional Contributor
Posts: 8

Problem exporting numeric data to Excel

We need to send a comma-delimited file to another party, the recipients are not technically sophisticated. We need the certain numeric data (stored in SAS char variables) to have the leading zeroes preserved and be displayed as text in the CSV file. We're using Excel 2003 and if the number of rows is under the limit I can use proc export to excel and get the desired result. However, the number of rows is usually above the limit and I have not found a workable solution. I'd like to find a solution where SAS will generate the file in the desired format and neither I nor the users will have to spend time converting it to something usable.
Super Contributor
Super Contributor
Posts: 3,174

Re: Problem exporting numeric data to Excel

If you append a leading "'" (single quote mark) to any CSV-formatted cell/column value, Excel automatically treats it as character, as-is, where-is. It's up to you to perform the DATA MANIPULATION using a Data Step technique, with a PUT function in a SAS variable assignment statement.

Scott Barry
SBBWorks, Inc.
Post a Question
Discussion Stats
  • 1 reply
  • 2 in conversation