Recoding date field

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

Recoding date field

Jennifer Steffes
Hi Listserv-

I have a file that I am taking from Access and putting into excel and
then putting into SPSS.  The file has a field called "Response" that is
a date and lists the date we received a response from the different
participants.  This is not just one date, but rather several different
dates  However, for my final product I don't want dates, but want
instead to reocde it to say either "Response"(if there is a date) or "No
response" if that field is null.  However, I guess that I can not recode
if it is a date.  I have tried to change it to a string, but then get a
huge number (which I don't mind necessarily, but am not sure how to
easily reocde that either).  Any suggestions as to how best to get this
field from a date (such as 12/6/07) to "Response".  Thanks in advance
for any help you can give me.

Jenny

=====================
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: Recoding date field

Art Kendall
set a flag if the date in response is later than some past date, here
January 1, 1800.
This avoids the bad programming practice of writing over a variable.
try this untested syntax.
compute responded = response gt date.mdy(1,1,1800).
value labels responded
    0 'no'
    1 'yes'.

Art Kendall
Social Research Consultants

Jennifer Steffes wrote:

> Hi Listserv-
>
> I have a file that I am taking from Access and putting into excel and
> then putting into SPSS.  The file has a field called "Response" that is
> a date and lists the date we received a response from the different
> participants.  This is not just one date, but rather several different
> dates  However, for my final product I don't want dates, but want
> instead to reocde it to say either "Response"(if there is a date) or "No
> response" if that field is null.  However, I guess that I can not recode
> if it is a date.  I have tried to change it to a string, but then get a
> huge number (which I don't mind necessarily, but am not sure how to
> easily reocde that either).  Any suggestions as to how best to get this
> field from a date (such as 12/6/07) to "Response".  Thanks in advance
> for any help you can give me.
>
> Jenny
>
> =====================
> 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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

R: Recoding date field

Luca Meyer
In reply to this post by Jennifer Steffes
Hello Jenny,

Try this:

/* sample data */
DATA LIST FREE /DATE (DATE12).
BEGIN DATA
06-SEP-2007
.
09-MAR-2007
END DATA.
EXE.

/* here is the syntax I think you need */
IF NOT SYSMIS(DATE) RESPONSE=1.
IF SYSMIS(DATE) RESPONSE=2.
VAL LABEL RESPONSE 1 "Response" 2 "No response".
FREQ RESPONSE.

BTW, why do you first import into Excel and the into SPSS? SPSS can read
directly Access files.

HTH,
Luca

Mr. Luca MEYER
Market research, data analysis & more
www.lucameyer.com - Tel: +39.339.495.00.21


-----Messaggio originale-----
Da: SPSSX(r) Discussion [mailto:[hidden email]] Per conto di
Jennifer Steffes
Inviato: lunedì 10 dicembre 2007 16.11
A: [hidden email]
Oggetto: Recoding date field

Hi Listserv-

I have a file that I am taking from Access and putting into excel and then
putting into SPSS.  The file has a field called "Response" that is a date
and lists the date we received a response from the different participants.
This is not just one date, but rather several different dates  However, for
my final product I don't want dates, but want instead to reocde it to say
either "Response"(if there is a date) or "No response" if that field is
null.  However, I guess that I can not recode if it is a date.  I have tried
to change it to a string, but then get a huge number (which I don't mind
necessarily, but am not sure how to easily reocde that either).  Any
suggestions as to how best to get this field from a date (such as 12/6/07)
to "Response".  Thanks in advance for any help you can give me.

Jenny

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

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.17/1179 - Release Date: 09/12/2007
11.06


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.17/1179 - Release Date: 09/12/2007
11.06

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