Save it to a .txt file (not .csv file) from SAS. Read the .txt file
from Excel, in the wizard step 3, you can specify the field as a text
field and the leading zero will be reserved.
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Sent: Friday, April 22, 2005 8:14 AM
Subject: Outputting to Excel & dropping leading zeros in character field
Hi all -
a quick question for a beautiful Friday day -
One of my co-workers is outputting some SAS output to Excel, via ODS
One required field is a county code that has values like '09009' etc.
drops the leading zeros. This is a key field that needs to be used in
merges, etc. so we've been trying a variety of methods to get around
The main issue being that this is something she's going to have to do a
LOT, so doesn't want any extra steps in there if at all possible.
ie we've looked at outputting to a .csv or .txt file then importing into
Excel - doesn't work as well as a few extra steps.
Any quick, easy solutions?
We've tried just forcing Excel to recognized the fields as text not
numeric, but can never get the leading zeros back.