Recode Into Different Variable: End Points

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

Recode Into Different Variable: End Points

jimjohn
I just ran the following syntax:
Can someone plz tell me, when it specifies 0 thru 30, does this mean 0 and 30 are both included.
For example, is it like this:
0 <= Age < 30
30 <= Age < 60
60 <= Age < 90 ... and so on
Thanks!


RECODE Age (0 thru 30=1) (30 thru 60=2) (60 thru 90=3) (90 thru 120=4) (120 thru 150=5) (150 thru 180=6) (180 thru 210=7) (210 thru
   240=8) (240 thru 270=9) (270 thru 300=10) (300 thru 330=11) (330 thru 360=12) (360 thru 365=13) INTO AgeMonthly.
EXECUTE.
Reply | Threaded
Open this post in threaded view
|

Re: Recode Into Different Variable: End Points

Oliver, Richard
RECODE evaluates left to right, and each value is recoded only once, so (0 thru 30) includes both 0 and 30, but (30 thru 60) includes 60 but not 30, since 30 was included in the previous specification.

If 0 is the lowest value:

recode (lo thru 30=1) (lo thru 60=2) (lo thru 90=3)...etc.

will yield the same result as your code example, which gives age categories of:

0 <= age <= 30
30 < age <= 60
60 < age <= 90

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of jimjohn
Sent: Thursday, September 11, 2008 2:19 PM
To: [hidden email]
Subject: Recode Into Different Variable: End Points

I just ran the following syntax:
Can someone plz tell me, when it specifies 0 thru 30, does this mean 0 and
30 are both included.
For example, is it like this:
0 <= Age < 30
30 <= Age < 60
60 <= Age < 90 ... and so on
Thanks!


RECODE Age (0 thru 30=1) (30 thru 60=2) (60 thru 90=3) (90 thru 120=4) (120
thru 150=5) (150 thru 180=6) (180 thru 210=7) (210 thru
   240=8) (240 thru 270=9) (270 thru 300=10) (300 thru 330=11) (330 thru
360=12) (360 thru 365=13) INTO AgeMonthly.
EXECUTE.

--
View this message in context: http://www.nabble.com/Recode-Into-Different-Variable%3A-End-Points-tp19442397p19442397.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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

=====================
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
|

data saved as .dbf loses numerical values

Roberts, Michael
Good evening list,

I would like to know if anyone has experienced losing data values when
saving a file as .dbf?  I have a text file (essentially a data dump)
which I have read into SPSS v14.01, and saved it as an SPSS file.  Then,
because I need to make it accessible to SQL Server 2000 users saved the
file as a dbf IV for import into dbf.  However, the saved (tranlated)
file now is missing numerical values at what seems to be random
locations!

Can anyone comment or suggest something I can check.  I know these
values are missing because I selected a range of known values and
compared the .sav and .dbf files and found that the .dbf data was
missing what appeared to be random numerical values.

TIA

Mike

=====================
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
|

Re: Recode Into Different Variable: End Points

Baker, Harley
In reply to this post by Oliver, Richard
Here is another way to do the recode that is useful especially when (a)
there is a large number of categories or intervals, and (b) each category or
interval (except the last one) is the same width.

For this example it would be something like:

compute agemonthly = trunc(age/30) + 1.

This would generate the following values for agemonthly:

0 < age <= 30 = 1
30 < age <= 60 = 2
60 < age <=90 = 3,
. . .
. . .
. . .
360 < age <= 365 = 13
etc.

Harley

Dr. Harley Baker
Associate Professor and Chair, Psychology Program
California State University Channel Islands
One University Drive
Camarillo, CA 93012

805.437.8997 (p)
805.437.8951 (f)

[hidden email]



> From: "Oliver, Richard" <[hidden email]>
> Reply-To: "Oliver, Richard" <[hidden email]>
> Date: Thu, 11 Sep 2008 16:16:53 -0500
> To: <[hidden email]>
> Conversation: Recode Into Different Variable: End Points
> Subject: Re: Recode Into Different Variable: End Points
>
> RECODE evaluates left to right, and each value is recoded only once, so (0
> thru 30) includes both 0 and 30, but (30 thru 60) includes 60 but not 30,
> since 30 was included in the previous specification.
>
> If 0 is the lowest value:
>
> recode (lo thru 30=1) (lo thru 60=2) (lo thru 90=3)...etc.
>
> will yield the same result as your code example, which gives age categories
> of:
>
> 0 <= age <= 30
> 30 < age <= 60
> 60 < age <= 90
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
> jimjohn
> Sent: Thursday, September 11, 2008 2:19 PM
> To: [hidden email]
> Subject: Recode Into Different Variable: End Points
>
> I just ran the following syntax:
> Can someone plz tell me, when it specifies 0 thru 30, does this mean 0 and
> 30 are both included.
> For example, is it like this:
> 0 <= Age < 30
> 30 <= Age < 60
> 60 <= Age < 90 ... and so on
> Thanks!
>
>
> RECODE Age (0 thru 30=1) (30 thru 60=2) (60 thru 90=3) (90 thru 120=4) (120
> thru 150=5) (150 thru 180=6) (180 thru 210=7) (210 thru
>    240=8) (240 thru 270=9) (270 thru 300=10) (300 thru 330=11) (330 thru
> 360=12) (360 thru 365=13) INTO AgeMonthly.
> EXECUTE.
>
> --
> View this message in context:
> http://www.nabble.com/Recode-Into-Different-Variable%3A-End-Points-tp19442397p
> 19442397.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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
>
> =====================
> 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

=====================
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