Does anyone have experience with the Syntax-command LPAD?
I´ll try to explain my difficulty:
There is data like this
120305
35031
120301
02051
etc.
The variable is a String-Variable (var1) and I want all data with 6
digits. If a string has only 5 digits (for example like 35031), I want
SPSS to attach a 0 at the beginning of the string (like 035031).
I´ve tried to first RTRIM it and then COMPUTE test=LPAD(var1,6,0), but
SPSS gave me a problem report.
Does anybody have an idea or maybe a solution?
Thank you for every kind of help,
Clemens
COMPUTE TEST = LPAD(RTRIM(var1),6,'0').
or
IF (SUBSTR(var1,6,1) = ' ') SUBSTR(var1,6,1) = '0'.
Jonathan Fry
SPSS Inc.
"Jonathan Fry" <j...@spss.com.REMOVETHIS> schrieb im Newsbeitrag
news:e0rv0e$c81$1...@netsrv2.spss.com...