Reputation: 139
I have a SAS data set with the first column being customer account IDs with 20 digit. I need to write my output of the table to a excel file. when i write to excel file account ids are truncated and last few digits turn zero.
please help. i need to write in excel format and in text to column format.
Upvotes: 0
Views: 2813
Reputation: 7769
You can use ODS HTML to export the data to Excel, use a .xls extension instead of .htm - the content is still HTML, but Excel interprets it into a nice table. You can then apply the usual ODS styles, titles, etc. should you wish.
Example :
data dummy ; do d = 1 to 20 ; longnum = put(ranuni(0)*(10**20),z20.) ; output ; end ; run ; ods html body="c:\temp\LongNumbers.xls" ; proc report data=dummy nowd ; define longnum / style={tagattr="style='mso-number-format:""\@""'"} ; run ; ods html close ;
There are a lot more mso-number-format
values which can be used :
Upvotes: 1
Reputation: 5452
This is down to how Excel represents numeric data. Export the file from SAS as a CSV and then import it into Excel. When selecting the column type for your ID field, choose 'text'.
Upvotes: 0