How to display the 0 before the decimal point.

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

How to display the 0 before the decimal point.

luhuazhao
How to display the 0 before the decimal point.

Hello, I have two spss questions. Can anyone help?

1. I would like to display the number as 0.65 instead of .65.  How should I do it using syntax?

2. I am writing my data to an external txt file using "write outfile=" .txt" records=4…….".  For example, when a F8.2 numeric variable is written to an external file I got

"   99.99", but what I need is "99.99".  How can I remove these blank spaces?

Reply | Threaded
Open this post in threaded view
|

Re: How to display the 0 before the decimal point.

Maguin, Eugene
Luhua,

>>1. I would like to display the number as 0.65 instead of .65.  How should
I do it using syntax?

I'm not sure how to do this directly using a numeric format. Perhaps
somebody else knows. I do think it is possible if you convert the number to
a string and pad the left most blanks with 0's. That, however, is a lot of
work for no particular gain--so far as I can see.

>>2. I am writing my data to an external txt file using "write outfile="
.txt" records=4...".  For example, when a F8.2 numeric variable is written
to an external file I got
"   99.99", but what I need is "99.99".  How can I remove these blank
spaces?

Change your format from F8.2 to F5.2. However, if there can be a value of
999.99, for instance, a F5.2 format will screw things up.

Gene Maguin

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD