Date: Mon, 25 Mar 2002 11:58:42 -0500
Reply-To: hdaley@dmhmrsas.state.va.us
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Hank Daley <hdaley@dmhmrsas.state.va.us>
Subject: Re: Please remind me ....
Content-Type: text/plain; charset="iso-8859-1"
=IF(LEN(A1)=1,"000"&($A1),IF(LEN(A1)=2,"00"&($A1),IF(LEN(A1)=3,"0"&($A1),$A1
)))
is a formula solution for XL.
From SPSS I would output an ASCII file defining the field as text, then XL
would bring in with leading zeroes.
Such a routine could easily be automated using Access, even XL.
Hank Daley
Policy Analyst
hdaley@dmhmrsas.state.va.us
-----Original Message-----
From: Staffan Lindberg [mailto:staffan.lindberg@fhi.se]
Sent: Monday, March 25, 2002 11:03 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Please remind me ....
Hi listers !
I know I have seen this before in this list but cannot find it now.
I have a 1-4 digit numerical variable in SPSS. I would like to convert it
into a 4 character string variable (right justified) with leading zeros.. I
want to later export this to Excel keeping the variable with leading zeros.
I managed to fix it in SPSS with the Nw-format but after export to Excel, no
leading zeros showed.
Thankful for any help
Staffan Lindberg
National Institute of Public Health
Sweden