Merge or replace variables assistance needed

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

Merge or replace variables assistance needed

Christine-28
Hi there, I have tried replacing missing values but can't seem to solve this
problem. I'm using version 15 of SPSS.

my file is set up like this:

  Collection Date Interview Date  . 22-Jul-08  4-Aug-68 30-May-08  .
6-Dec-07  . 11-Apr-08  11-Mar-07 30-Nov-07  30-Apr-07 30-Apr-07  14-May-07
13-May-08
The help I need is as follows:
1. Where collection date is missing, replace with interview date
2. Where collection date is prior to 2007, replace with interview date.

Any assistance is appreciated.

Thanks

=====================
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: Merge or replace variables assistance needed

Keith Jackman
Hi Christine,

The first test is fairly straight forward.  Simply check if the collection
date is missing uning the MISSING function and if it is, replace it with the
interview date.

The second test is a little more involved in that it requires you to extract
the year from the date variable using the XDATE function.

Assuming you have 2 variables - collection and interview - both are
formatted as dates.  The syntax would be...

***.

IF (missing(collection)) collection=interview.

IF (XDATE.YEAR(collection)<2007) collection=interview.

EXECUTE.



Hope this helps,

Keith



----- Original Message -----
From: "Christine" <[hidden email]>
To: <[hidden email]>
Sent: Monday, January 05, 2009 8:19 PM
Subject: Merge or replace variables assistance needed


> Hi there, I have tried replacing missing values but can't seem to solve
> this
> problem. I'm using version 15 of SPSS.
>
> my file is set up like this:
>
>  Collection Date Interview Date  . 22-Jul-08  4-Aug-68 30-May-08  .
> 6-Dec-07  . 11-Apr-08  11-Mar-07 30-Nov-07  30-Apr-07 30-Apr-07  14-May-07
> 13-May-08
> The help I need is as follows:
> 1. Where collection date is missing, replace with interview date
> 2. Where collection date is prior to 2007, replace with interview date.
>
> Any assistance is appreciated.
>
> Thanks
>
> =====================
> 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
|

Re: Merge or replace variables assistance needed

Melissa Ives
Or do it in one pass...
IF (missing(collection) or XDATE.YEAR(collection)<2007) collection=interview.

Melissa

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Keith Jackman
Sent: Monday, January 05, 2009 11:30 PM
To: [hidden email]
Subject: Re: [SPSSX-L] Merge or replace variables assistance needed

Hi Christine,

The first test is fairly straight forward.  Simply check if the collection date is missing uning the MISSING function and if it is, replace it with the interview date.

The second test is a little more involved in that it requires you to extract the year from the date variable using the XDATE function.

Assuming you have 2 variables - collection and interview - both are formatted as dates.  The syntax would be...

***.

IF (missing(collection)) collection=interview.

IF (XDATE.YEAR(collection)<2007) collection=interview.

EXECUTE.



Hope this helps,

Keith



----- Original Message -----
From: "Christine" <[hidden email]>
To: <[hidden email]>
Sent: Monday, January 05, 2009 8:19 PM
Subject: Merge or replace variables assistance needed


> Hi there, I have tried replacing missing values but can't seem to
> solve this problem. I'm using version 15 of SPSS.
>
> my file is set up like this:
>
>  Collection Date Interview Date  . 22-Jul-08  4-Aug-68 30-May-08  .
> 6-Dec-07  . 11-Apr-08  11-Mar-07 30-Nov-07  30-Apr-07 30-Apr-07
> 14-May-07
> 13-May-08
> The help I need is as follows:
> 1. Where collection date is missing, replace with interview date 2.
> Where collection date is prior to 2007, replace with interview date.
>
> Any assistance is appreciated.
>
> Thanks
>
> =====================
> 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

PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND
CONFIDENTIAL information and is intended only for the use of the
addressee. If you are not the designated recipient, or an employee
or agent authorized to deliver such transmittals to the designated
recipient, you are hereby notified that any dissemination,
copying or publication of this transmittal is strictly prohibited. If
you have received this transmittal in error, please notify us
immediately by replying to the sender and delete this copy from your
system. You may also call us at (309) 827-6026 for assistance.

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