need to add leading zero to some values but not all.

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

need to add leading zero to some values but not all.

msherman
Dear list: I have a variable that has values of 7 digits and 8 digits. The 7 digit needs a zero in front of the first number. The variable is a string which will be converted into a date once I get the zero in place. Advice appreciated. Could not find an answer at spsstools. net. thanks, martin sherman
Reply | Threaded
Open this post in threaded view
|

IDE meaning

Maguin, Eugene
All,

As you have seen, spss is seeking ideas about how to improve the editor. One
idea seems to involve an 'integrated development environment' editor. They
offer as examples of an IDE editor, if I recall correctly, the microsoft
macro editor and another that I don't recall. I have never used the MS macro
editor except for the most simple operation of deleting a macro or changing
a term in a keyboard macro. My question is whether the editors that I am
familiar with qualifiy as an IDE editor. Thus:

Does the multiedit (either lite or regular) qualify?
Does the mplus editor qualify?

Thanks, Gene Maguin
Reply | Threaded
Open this post in threaded view
|

Re: need to add leading zero to some values but not all.

Maguin, Eugene
In reply to this post by msherman
Martin,

Let x be A8

If (substr(x,8,1) eq ' ') x=concat('0',substr(x,1,7)).


Gene Maguin
Reply | Threaded
Open this post in threaded view
|

Re: need to add leading zero to some values but not all.

Oliver, Richard
In reply to this post by msherman
No need to add the leading zero:

data list free /datestring (a8).
begin data
10211958
8131951
1012000
end data

compute #datenumber=number(datestring, f8).
compute #year=mod(#datenumber, 10000).
compute #day=mod(trunc(#datenumber/10000),100).
compute #month=trunc(#datenumber/1000000).
compute realDate=date.mdy(#month, #day, #year).
formats realDate (adate10).
list.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Martin Sherman
Sent: Tuesday, October 02, 2007 2:26 PM
To: [hidden email]
Subject: need to add leading zero to some values but not all.

Dear list: I have a variable that has values of 7 digits and 8 digits. The 7 digit needs a zero in front of the first number. The variable is a string which will be converted into a date once I get the zero in place. Advice appreciated. Could not find an answer at spsstools. net. thanks, martin sherman
Reply | Threaded
Open this post in threaded view
|

Re: IDE meaning

Richard Ristow
In reply to this post by Maguin, Eugene
At 04:19 PM 10/2/2007, Gene Maguin wrote:

>As you have seen, spss is seeking ideas about how to improve the
>editor. One idea seems to involve an 'integrated development
>environment' (IDE) editor. My question is whether the editors that I
>am familiar with qualifiy as an IDE editor. Thus:
>
>Does the multiedit (either lite or regular) qualify?
>Does the mplus editor qualify?

I'm not a heavy IDE user myself, but in both cases the answer is
probably 'no'; generally, no general-purpose editor qualifies as an
IDE.

An IDE includes, first, an editor that's syntax-aware. That is, it
parses lines as code for the language the IDE supports. Typically, it
can identify syntax errors; can match opening and closing parentheses,
and opening and closing of multi-statement constructs; can recognize
variable names, and perhaps build an index of their occurrences. Some
general-purpose editors can act as syntax-aware editors if given a
syntax definition for the programming language.

In addition, an IDE includes tools for observing and debugging the
program during execution. Typical services include setting
'breakpoints', places where the program will halt execution (which may
later be resumed); displaying variable values, when the program is
halted; stepping through the program a line at a time, allowing
variable values to be inspected after each line.

Pythonwin is an IDE for Python (not Python under SPSS, though it'll run
SPSS under Python), so that's an example to experiment with.

-Best regards,
  Richard
Reply | Threaded
Open this post in threaded view
|

Re: IDE meaning

John McConnell
Another example - already developed by SPSS - is mrStudio which is part
of the Dimensions platform:

http://www.spss.com/mrstudio/

john

John McConnell
Applied Insights

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Richard Ristow
Sent: 12 October 2007 22:01
To: [hidden email]
Subject: Re: IDE meaning

At 04:19 PM 10/2/2007, Gene Maguin wrote:

>As you have seen, spss is seeking ideas about how to improve the
>editor. One idea seems to involve an 'integrated development
>environment' (IDE) editor. My question is whether the editors that I
>am familiar with qualifiy as an IDE editor. Thus:
>
>Does the multiedit (either lite or regular) qualify?
>Does the mplus editor qualify?

I'm not a heavy IDE user myself, but in both cases the answer is
probably 'no'; generally, no general-purpose editor qualifies as an
IDE.

An IDE includes, first, an editor that's syntax-aware. That is, it
parses lines as code for the language the IDE supports. Typically, it
can identify syntax errors; can match opening and closing parentheses,
and opening and closing of multi-statement constructs; can recognize
variable names, and perhaps build an index of their occurrences. Some
general-purpose editors can act as syntax-aware editors if given a
syntax definition for the programming language.

In addition, an IDE includes tools for observing and debugging the
program during execution. Typical services include setting
'breakpoints', places where the program will halt execution (which may
later be resumed); displaying variable values, when the program is
halted; stepping through the program a line at a time, allowing
variable values to be inspected after each line.

Pythonwin is an IDE for Python (not Python under SPSS, though it'll run
SPSS under Python), so that's an example to experiment with.

-Best regards,
  Richard