Leading Zeros for zip codes

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

Leading Zeros for zip codes

Sea, Carleton, VBAVACO
Leading Zeros for zip codes

I have a numeric variable (ID), which has a width of 15.  Some of the cases only contain 13 digits and I would like to convert the cases to include leading zeros so that all cases have 15 digits. (i.e., 001234567890123).

Any assistance on this syntax would be appreciated.


Thank you.

Carleton Sea

Reply | Threaded
Open this post in threaded view
|

Re: Leading Zeros for zip codes

Oliver, Richard
Leading Zeros for zip codes

Us N format:

 

data list free /var1.

begin data

1 12 123 1234 12345

end data.

formats var1 (N5).

list.

 


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Sea, Carleton, VBAVACO
Sent: Wednesday, September 16, 2009 12:46 PM
To: [hidden email]
Subject: Leading Zeros for zip codes

 

I have a numeric variable (ID), which has a width of 15.  Some of the cases only contain 13 digits and I would like to convert the cases to include leading zeros so that all cases have 15 digits. (i.e., 001234567890123).

Any assistance on this syntax would be appreciated.

 

Thank you.

Carleton Sea

Reply | Threaded
Open this post in threaded view
|

Re: Leading Zeros for zip codes

Richard Ristow
In reply to this post by Sea, Carleton, VBAVACO
At 01:45 PM 9/16/2009, Sea, Carleton, VBAVACO wrote:

>I have a numeric variable (ID), which has a width of 15.  Some of
>the cases only contain 13 digits and I would like to convert the
>cases to include leading zeros so that all cases have 15 digits.
>(i.e., 001234567890123).

Richard Oliver is correct:

>Use N format:
>formats ZIP (N15).

Since you're using long codes, one warning: 15 digits is the longest
integer that SPSS is guaranteed to store and reproduce exactly.

=====================
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
Reply | Threaded
Open this post in threaded view
|

COMPUTING a median or a mode

Mccoach, D. Betsy
In reply to this post by Oliver, Richard
Leading Zeros for zip codes

Hi--- Silly question, but I’m stuck.

 

I routinely create the mean of multiple variables using the following syntax:

 

COMPUTE MEAN_X= MEAN (X1, X2, X3, X4).

EXECUTE.

 

Now I want to do the same thing, but I want to compute either the MEDIAN or the MODE for a group of variables, and I seem to be unable to do this in SPSS.

I’ve tried---

 

COMPUTE MED_X= MEDIAN (X1, X2, X3, X4).

EXECUTE.

 

 Which seems like it should work, but it doesn’t.

Any help would be greatly appreciated.

 

Thanks so much,

 

Betsy

 

 

 

D. Betsy McCoach, Ph.D.

Associate Professor

Measurement, Evaluation, and Assessment Program

Educational Psychology Department

University of Connecticut

249 Glenbrook Road, Unit 2064

Storrs, CT 06269-2064

Phone: 860-486-0183

Fax: 860-486-0180

Email: [hidden email]

 

*** TEMPORARY OFFICE: 206 Koons Hall (May 2009- January 2010)

 

Reply | Threaded
Open this post in threaded view
|

Re: COMPUTING a median or a mode

Mike
Leading Zeros for zip codes
Hi all,
 
I assume that you want to compute a WITHIN CASE median
or mode in contrast to a startistic computed across cases.
A couple of points:
 
(1)  According to 1990 SPSS Syntax Manual (the "White Manual"
single volume phoneboo which came out after SPSS stopped selling
itself as SPSS**X) the statistical functions that can be performed
WITHIN CASES through the compute procedure include:
 
Sum
compute Xsum=sum.n(X1.,X2..,XN).
Mean
compute Xmean=mean.n(X1.,X2..,XN).
Standard Deviation
compute Xsd=SD.n(X1.,X2..,XN).
Variance
compute Xvar=VAR.n(X1,X2,..,XN).
Coefficient of Variation
compute Xcv=CFVAR.n(X1,X2,...,XN).
Minimum
compute Xmin=min.n(X1,X2,...,XN).
Maximum
compute Xmax=max.n(X1,X2,...,XN).
NOTE: the ".n" extension identifies the minimum number of valid
value to allow the calculation.
 
(2)  The 1990 "White" phonebook-style manual lists these
capabilities which means that they were available around
version 4.00 of SPSS.  Whether the versions since then have
maintained them, added to them, or removed some of them,
is unclear.  In examining the PDF manual for version 15, I
am unable to locate the comparable list (which may argue
for the value of a paper manual over a hypertext one, that is,
a poorly structured hypertext manual).  Over the years
a number of features have been added, deleted, or morphed
into something else.  I leave it to one of the people either
working for SPSS or have been obsessive-compulsive in
tracking the changes in SPSS over the years to tell you
whether they have implemented   It is telling, however,
that determining what statistical procedures can be
done within-cases can not be easily determined, say,
by just highlighting the compute command in a syntax
file and then clicking on syntax info icon.
 
Then again, maybe it's just me.
 
-Mike Palij
New York University
 
----- Original Message -----
Sent: Wednesday, September 23, 2009 1:11 PM
Subject: COMPUTING a median or a mode

Hi--- Silly question, but I’m stuck.

 

I routinely create the mean of multiple variables using the following syntax:

 

COMPUTE MEAN_X= MEAN (X1, X2, X3, X4).

EXECUTE.

 

Now I want to do the same thing, but I want to compute either the MEDIAN or the MODE for a group of variables, and I seem to be unable to do this in SPSS.

I’ve tried---

 

COMPUTE MED_X= MEDIAN (X1, X2, X3, X4).

EXECUTE.

 

 Which seems like it should work, but it doesn’t.

Any help would be greatly appreciated.

 

Thanks so much,

 

Betsy

 

 

 

D. Betsy McCoach, Ph.D.

Associate Professor

Measurement, Evaluation, and Assessment Program

Educational Psychology Department

University of Connecticut

249 Glenbrook Road, Unit 2064

Storrs, CT 06269-2064

Phone: 860-486-0183

Fax: 860-486-0180

Email: [hidden email]

 

*** TEMPORARY OFFICE: 206 Koons Hall (May 2009- January 2010)

 

Reply | Threaded
Open this post in threaded view
|

Re: COMPUTING a median or a mode

Peck, Jon
In reply to this post by Mccoach, D. Betsy
Leading Zeros for zip codes

There is a within-case Median function.  It in at least version 17.

 

MEDIAN. MEDIAN(numexpr,numexpr[,..]). Numeric. Returns the median (50th percentile) of its

arguments that have valid, nonmissing values. This function requires two or more arguments,

which must be

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Mccoach, D. Betsy
Sent: Wednesday, September 23, 2009 11:11 AM
To: [hidden email]
Subject: [SPSSX-L] COMPUTING a median or a mode

 

Hi--- Silly question, but I’m stuck.

 

I routinely create the mean of multiple variables using the following syntax:

 

COMPUTE MEAN_X= MEAN (X1, X2, X3, X4).

EXECUTE.

 

Now I want to do the same thing, but I want to compute either the MEDIAN or the MODE for a group of variables, and I seem to be unable to do this in SPSS.

I’ve tried---

 

COMPUTE MED_X= MEDIAN (X1, X2, X3, X4).

EXECUTE.

 

 Which seems like it should work, but it doesn’t.

Any help would be greatly appreciated.

 

Thanks so much,

 

Betsy

 

 

 

D. Betsy McCoach, Ph.D.

Associate Professor

Measurement, Evaluation, and Assessment Program

Educational Psychology Department

University of Connecticut

249 Glenbrook Road, Unit 2064

Storrs, CT 06269-2064

Phone: 860-486-0183

Fax: 860-486-0180

Email: [hidden email]

 

*** TEMPORARY OFFICE: 206 Koons Hall (May 2009- January 2010)

 

Reply | Threaded
Open this post in threaded view
|

Re: COMPUTING a median or a mode

Oliver, Richard
Leading Zeros for zip codes

Minor clarification: The Median function was added in release 17.  It does not work in earlier releases.

 


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Peck, Jon
Sent: Wednesday, September 23, 2009 1:58 PM
To: [hidden email]
Subject: Re: COMPUTING a median or a mode

 

There is a within-case Median function.  It in at least version 17.

 

MEDIAN. MEDIAN(numexpr,numexpr[,..]). Numeric. Returns the median (50th percentile) of its

arguments that have valid, nonmissing values. This function requires two or more arguments,

which must be

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Mccoach, D. Betsy
Sent: Wednesday, September 23, 2009 11:11 AM
To: [hidden email]
Subject: [SPSSX-L] COMPUTING a median or a mode

 

Hi--- Silly question, but I’m stuck.

 

I routinely create the mean of multiple variables using the following syntax:

 

COMPUTE MEAN_X= MEAN (X1, X2, X3, X4).

EXECUTE.

 

Now I want to do the same thing, but I want to compute either the MEDIAN or the MODE for a group of variables, and I seem to be unable to do this in SPSS.

I’ve tried---

 

COMPUTE MED_X= MEDIAN (X1, X2, X3, X4).

EXECUTE.

 

 Which seems like it should work, but it doesn’t.

Any help would be greatly appreciated.

 

Thanks so much,

 

Betsy

 

 

 

D. Betsy McCoach, Ph.D.

Associate Professor

Measurement, Evaluation, and Assessment Program

Educational Psychology Department

University of Connecticut

249 Glenbrook Road, Unit 2064

Storrs, CT 06269-2064

Phone: 860-486-0183

Fax: 860-486-0180

Email: [hidden email]

 

*** TEMPORARY OFFICE: 206 Koons Hall (May 2009- January 2010)