LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (April 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 22 Apr 2005 08:28:32 -0700
Reply-To:   "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Subject:   Re: Outputting to Excel & dropping leading zeros in character fie ld
Comments:   To: Venita DePuy <depuy001@NOTES.DUKE.EDU>

The problem is that HTML tables don't know the difference between a number and character, so you can't define a number as a character, unless you preprocess it and change it to a character and add a leading single quote.

If you use the V9 Excel engine SAS will write out character strings of numbers with leading zeros correctly.

hth

Paul Choate DDS Data Extraction (916) 654-2160

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Venita DePuy Sent: Friday, April 22, 2005 8:14 AM To: SAS-L@LISTSERV.UGA.EDU 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 html output. One required field is a county code that has values like '09009' etc. SAS 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 this. 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.

Thanks! Venita


Back to: Top of message | Previous page | Main SAS-L page