problem with missing data in date variables

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

problem with missing data in date variables

Elizabeth Tighe
we have a date variable formatted as (ADATE10)

some used our traditional specific missing values when the date was
missing, such as -999 or -995.

These specific missing values have value labels, such as Missing:
Unspecified or Missing: Not Applicable

The frequencies for the date variable recognizes these values as
specific missing.  However, the values of -999 and -995 are lost. The
values appear in frequency tables as ".Missing: Unspecified"

Is there a way to recode these specific missing variables back into a
specific missing date variable, such as

IF (date EQ .Missing:Not Applicable) date=date.mdy(01/01/1800).

MISSING VALUES date ("01/01/1800").

I cannot figure out how to recode these ".Missing: Label" values.

Any tips/tricks would be much appreciated!

=====================
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: problem with missing data in date variables

Bruce Weaver
Administrator
What is the source of the data--e.g., are you importing from Excel or some other type of non-SPSS file?  If so, you could import the date variable(s) in question as STRING variables initially, do whatever recoding you want to do, then convert the variable(s) to a date format via ALTER TYPE.

If the data are already in an SPSS data file and the date variables formatted as date variables, you'll have the system missing value (SYSMIS) where things are missing.  In that case, you can still recode all of the missing values to some proper date value of your choosing; but you'll not be able to distinguish between different reasons for the missing data (i.e., your -999 and -995 codes).  

Here's a small example.

* Read in some sample data.
NEW FILE.
DATASET CLOSE all.
DATA LIST list / DateVar(adate10).
BEGIN DATA
6/4/2014
12/25/2013
.
END DATA.

IF SYSMIS(DateVar) DateVar = date.dmy(1,1,1800).
MISSING VALUES DateVar ("1/1/1800").
VALUE LABELS DateVar "1/1/1800" "Missing".
FREQUENCIES DateVar.


Note the enclosure of the missing date value in quotes on the MISSING VALUES and VALUE LABELS lines.  The following is from the FM entry for MISSING VALUES:

* For date format variables (for example, DATE, ADATE), missing values expressed in date formats must be enclosed in single or double quotes, and values must be expressed in the same date format as the defined date format for the variable.

HTH.


Elizabeth Tighe wrote
we have a date variable formatted as (ADATE10)

some used our traditional specific missing values when the date was
missing, such as -999 or -995.

These specific missing values have value labels, such as Missing:
Unspecified or Missing: Not Applicable

The frequencies for the date variable recognizes these values as
specific missing.  However, the values of -999 and -995 are lost. The
values appear in frequency tables as ".Missing: Unspecified"

Is there a way to recode these specific missing variables back into a
specific missing date variable, such as

IF (date EQ .Missing:Not Applicable) date=date.mdy(01/01/1800).

MISSING VALUES date ("01/01/1800").

I cannot figure out how to recode these ".Missing: Label" values.

Any tips/tricks would be much appreciated!

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: problem with missing data in date variables

Elizabeth Tighe
all spss .sav files.  And no problem re: setting them all to some
general missing value, I can do that.  But, I'd prefer being able to
maintain the specific missing values if possible.  Since it appears the
program recognizes them as specific missing and they display in the
frequencies as specific missing, it seems a matter of figuring out how
those specific missing are represented numerically in the data maybe?

Thanks,
Liz Tighe


On 6/4/2014 3:42 PM, Bruce Weaver wrote:

> What is the source of the data--e.g., are you importing from Excel or some
> other type of non-SPSS file?  If so, you could import the date variable(s)
> in question as STRING variables initially, do whatever recoding you want to
> do, then convert the variable(s) to a date format via ALTER TYPE.
>
> If the data are already in an SPSS data file and the date variables
> formatted as date variables, you'll have the system missing value (SYSMIS)
> where things are missing.  In that case, you can still recode all of the
> missing values to some proper date value of your choosing; but you'll not be
> able to distinguish between different reasons for the missing data (i.e.,
> your -999 and -995 codes).
>
> Here's a small example.
>
> * Read in some sample data.
> NEW FILE.
> DATASET CLOSE all.
> DATA LIST list / DateVar(adate10).
> BEGIN DATA
> 6/4/2014
> 12/25/2013
> .
> END DATA.
>
> IF SYSMIS(DateVar) DateVar = date.dmy(1,1,1800).
> MISSING VALUES DateVar ("1/1/1800").
> VALUE LABELS DateVar "1/1/1800" "Missing".
> FREQUENCIES DateVar.
>
>
> Note the enclosure of the missing date value in quotes on the MISSING VALUES
> and VALUE LABELS lines.  The following is from the FM entry for MISSING
> VALUES:
>
> * For date format variables (for example, DATE, ADATE), missing values
> expressed in date formats must be enclosed in single or double quotes, and
> values must be expressed in the same date format as the defined date format
> for the variable.
>
> HTH.
>
>
>
> Elizabeth Tighe wrote
>> we have a date variable formatted as (ADATE10)
>>
>> some used our traditional specific missing values when the date was
>> missing, such as -999 or -995.
>>
>> These specific missing values have value labels, such as Missing:
>> Unspecified or Missing: Not Applicable
>>
>> The frequencies for the date variable recognizes these values as
>> specific missing.  However, the values of -999 and -995 are lost. The
>> values appear in frequency tables as ".Missing: Unspecified"
>>
>> Is there a way to recode these specific missing variables back into a
>> specific missing date variable, such as
>>
>> IF (date EQ .Missing:Not Applicable) date=date.mdy(01/01/1800).
>>
>> MISSING VALUES date ("01/01/1800").
>>
>> I cannot figure out how to recode these ".Missing: Label" values.
>>
>> Any tips/tricks would be much appreciated!
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>> LISTSERV@.UGA
>>   (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
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/problem-with-missing-data-in-date-variables-tp5726334p5726337.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

--

Elizabeth Tighe, Ph.D.
Research Scientist
Steinhardt Social Research Institute
Brandeis University
781.736.3824

=====================
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: problem with missing data in date variables

Rick Oliver-3
If they are recognized as different user-missing values, then the original values aren't lost, they just cannot be displayed as dates. So you just need to assign value labels to the original missing values.

data list free /datevar (adate10).
begin data
1/1/2014 2/15/2014 3/20/2014 5/1/2014
end data.
*create some values that aren't valid as date formats
to reproduce the scenario.
if datevar=date.mdy(5,1,2014) datevar=-999.
if datevar=date.mdy(3,20,2014) datevar=-998.
missing values datevar (-999, -998).
value labels datevar -999 'no answer' -998 'not applicable'.
frequencies variables=datevar.


Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]




From:        Elizabeth Tighe <[hidden email]>
To:        [hidden email],
Date:        06/04/2014 03:00 PM
Subject:        Re: problem with missing data in date variables
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




all spss .sav files.  And no problem re: setting them all to some
general missing value, I can do that.  But, I'd prefer being able to
maintain the specific missing values if possible.  Since it appears the
program recognizes them as specific missing and they display in the
frequencies as specific missing, it seems a matter of figuring out how
those specific missing are represented numerically in the data maybe?

Thanks,
Liz Tighe


On 6/4/2014 3:42 PM, Bruce Weaver wrote:
> What is the source of the data--e.g., are you importing from Excel or some
> other type of non-SPSS file?  If so, you could import the date variable(s)
> in question as STRING variables initially, do whatever recoding you want to
> do, then convert the variable(s) to a date format via ALTER TYPE.
>
> If the data are already in an SPSS data file and the date variables
> formatted as date variables, you'll have the system missing value (SYSMIS)
> where things are missing.  In that case, you can still recode all of the
> missing values to some proper date value of your choosing; but you'll not be
> able to distinguish between different reasons for the missing data (i.e.,
> your -999 and -995 codes).
>
> Here's a small example.
>
> * Read in some sample data.
> NEW FILE.
> DATASET CLOSE all.
> DATA LIST list / DateVar(adate10).
> BEGIN DATA
> 6/4/2014
> 12/25/2013
> .
> END DATA.
>
> IF SYSMIS(DateVar) DateVar = date.dmy(1,1,1800).
> MISSING VALUES DateVar ("1/1/1800").
> VALUE LABELS DateVar "1/1/1800" "Missing".
> FREQUENCIES DateVar.
>
>
> Note the enclosure of the missing date value in quotes on the MISSING VALUES
> and VALUE LABELS lines.  The following is from the FM entry for MISSING
> VALUES:
>
> * For date format variables (for example, DATE, ADATE), missing values
> expressed in date formats must be enclosed in single or double quotes, and
> values must be expressed in the same date format as the defined date format
> for the variable.
>
> HTH.
>
>
>
> Elizabeth Tighe wrote
>> we have a date variable formatted as (ADATE10)
>>
>> some used our traditional specific missing values when the date was
>> missing, such as -999 or -995.
>>
>> These specific missing values have value labels, such as Missing:
>> Unspecified or Missing: Not Applicable
>>
>> The frequencies for the date variable recognizes these values as
>> specific missing.  However, the values of -999 and -995 are lost. The
>> values appear in frequency tables as ".Missing: Unspecified"
>>
>> Is there a way to recode these specific missing variables back into a
>> specific missing date variable, such as
>>
>> IF (date EQ .Missing:Not Applicable) date=date.mdy(01/01/1800).
>>
>> MISSING VALUES date ("01/01/1800").
>>
>> I cannot figure out how to recode these ".Missing: Label" values.
>>
>> Any tips/tricks would be much appreciated!
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>> LISTSERV@.UGA
>>   (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
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
>
http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/problem-with-missing-data-in-date-variables-tp5726334p5726337.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

--

Elizabeth Tighe, Ph.D.
Research Scientist
Steinhardt Social Research Institute
Brandeis University
781.736.3824

=====================
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: problem with missing data in date variables

Bruce Weaver
Administrator
In reply to this post by Elizabeth Tighe
Can you generate a small dataset that illustrates the problem?  E.g.,

DATA LIST list / DateVar(ADATE10).
BEGIN DATA
{ fill in 8 or 10 of your date values here, one per row, including the various missing values }
END DATA.

I'm not understanding what the values are on cases that have your two (or more) distinct missing values.  If it is a true date variable, they cannot be -999 and -995, for example.  Sorry if I'm just being obtuse.  


Elizabeth Tighe wrote
all spss .sav files.  And no problem re: setting them all to some
general missing value, I can do that.  But, I'd prefer being able to
maintain the specific missing values if possible.  Since it appears the
program recognizes them as specific missing and they display in the
frequencies as specific missing, it seems a matter of figuring out how
those specific missing are represented numerically in the data maybe?

Thanks,
Liz Tighe


On 6/4/2014 3:42 PM, Bruce Weaver wrote:
> What is the source of the data--e.g., are you importing from Excel or some
> other type of non-SPSS file?  If so, you could import the date variable(s)
> in question as STRING variables initially, do whatever recoding you want to
> do, then convert the variable(s) to a date format via ALTER TYPE.
>
> If the data are already in an SPSS data file and the date variables
> formatted as date variables, you'll have the system missing value (SYSMIS)
> where things are missing.  In that case, you can still recode all of the
> missing values to some proper date value of your choosing; but you'll not be
> able to distinguish between different reasons for the missing data (i.e.,
> your -999 and -995 codes).
>
> Here's a small example.
>
> * Read in some sample data.
> NEW FILE.
> DATASET CLOSE all.
> DATA LIST list / DateVar(adate10).
> BEGIN DATA
> 6/4/2014
> 12/25/2013
> .
> END DATA.
>
> IF SYSMIS(DateVar) DateVar = date.dmy(1,1,1800).
> MISSING VALUES DateVar ("1/1/1800").
> VALUE LABELS DateVar "1/1/1800" "Missing".
> FREQUENCIES DateVar.
>
>
> Note the enclosure of the missing date value in quotes on the MISSING VALUES
> and VALUE LABELS lines.  The following is from the FM entry for MISSING
> VALUES:
>
> * For date format variables (for example, DATE, ADATE), missing values
> expressed in date formats must be enclosed in single or double quotes, and
> values must be expressed in the same date format as the defined date format
> for the variable.
>
> HTH.
>
>
>
> Elizabeth Tighe wrote
>> we have a date variable formatted as (ADATE10)
>>
>> some used our traditional specific missing values when the date was
>> missing, such as -999 or -995.
>>
>> These specific missing values have value labels, such as Missing:
>> Unspecified or Missing: Not Applicable
>>
>> The frequencies for the date variable recognizes these values as
>> specific missing.  However, the values of -999 and -995 are lost. The
>> values appear in frequency tables as ".Missing: Unspecified"
>>
>> Is there a way to recode these specific missing variables back into a
>> specific missing date variable, such as
>>
>> IF (date EQ .Missing:Not Applicable) date=date.mdy(01/01/1800).
>>
>> MISSING VALUES date ("01/01/1800").
>>
>> I cannot figure out how to recode these ".Missing: Label" values.
>>
>> Any tips/tricks would be much appreciated!
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>> LISTSERV@.UGA
>>   (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
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/problem-with-missing-data-in-date-variables-tp5726334p5726337.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

--

Elizabeth Tighe, Ph.D.
Research Scientist
Steinhardt Social Research Institute
Brandeis University
781.736.3824

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: problem with missing data in date variables

Bruce Weaver
Administrator
In reply to this post by Rick Oliver-3
That's a very interesting example, Rick.  When you look in the data editor, the two cases that you assigned values of -999 and -998 appear to be system missing, and they behave that way when you issue a LIST command, or when you compute a new numeric variable and set it equal to datevar (see below).  This is very curious behaviour!

* Rick Oliver's example.

data list free /datevar (adate10).
begin data
1/1/2014 2/15/2014 3/20/2014 5/1/2014
end data.
*create some values that aren't valid as date formats
to reproduce the scenario.
if datevar=date.mdy(5,1,2014) datevar=-999.
if datevar=date.mdy(3,20,2014) datevar=-998.
missing values datevar (-999, -998).
value labels datevar -999 'no answer' -998 'not applicable'.
frequencies variables=datevar.

* The -999 and -998 records are showing up as missing in the frequency table.
* But when you look at the data editor, there appear to be system missing
* indicators in those cells.

LIST.
* The warning message following LIST says,
* "The result has been set to the system-missing value." .
* But the missing values still show up with labels in output from FREQUENCIES.
frequencies variables=datevar.

* Try computing a new numeric variable and setting it equal to datevar.
COMPUTE x = datevar.
FORMATS x(F20.0).
LIST.
* Cases with datevar assigned -999 or -998 are treated as missing.
frequencies variables=datevar.
* Missing values still behaving 'properly' for FREQUENCIES.
* Why do they behave 'properly' for FREQUENCIES but not for other commands? .

By the way, I'm running v21.0.0.2 under Windoze 7 Professional, SP1.  (But I expect things behave the same way regardless of version and OS.)



Rick Oliver wrote
If they are recognized as different user-missing values, then the original
values aren't lost, they just cannot be displayed as dates. So you just
need to assign value labels to the original missing values.

data list free /datevar (adate10).
begin data
1/1/2014 2/15/2014 3/20/2014 5/1/2014
end data.
*create some values that aren't valid as date formats
to reproduce the scenario.
if datevar=date.mdy(5,1,2014) datevar=-999.
if datevar=date.mdy(3,20,2014) datevar=-998.
missing values datevar (-999, -998).
value labels datevar -999 'no answer' -998 'not applicable'.
frequencies variables=datevar.


Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]



From:   Elizabeth Tighe <[hidden email]>
To:     [hidden email],
Date:   06/04/2014 03:00 PM
Subject:        Re: problem with missing data in date variables
Sent by:        "SPSSX(r) Discussion" <[hidden email]>



all spss .sav files.  And no problem re: setting them all to some
general missing value, I can do that.  But, I'd prefer being able to
maintain the specific missing values if possible.  Since it appears the
program recognizes them as specific missing and they display in the
frequencies as specific missing, it seems a matter of figuring out how
those specific missing are represented numerically in the data maybe?

Thanks,
Liz Tighe


On 6/4/2014 3:42 PM, Bruce Weaver wrote:
> What is the source of the data--e.g., are you importing from Excel or
some
> other type of non-SPSS file?  If so, you could import the date
variable(s)
> in question as STRING variables initially, do whatever recoding you want
to
> do, then convert the variable(s) to a date format via ALTER TYPE.
>
> If the data are already in an SPSS data file and the date variables
> formatted as date variables, you'll have the system missing value
(SYSMIS)
> where things are missing.  In that case, you can still recode all of the
> missing values to some proper date value of your choosing; but you'll
not be
> able to distinguish between different reasons for the missing data
(i.e.,
> your -999 and -995 codes).
>
> Here's a small example.
>
> * Read in some sample data.
> NEW FILE.
> DATASET CLOSE all.
> DATA LIST list / DateVar(adate10).
> BEGIN DATA
> 6/4/2014
> 12/25/2013
> .
> END DATA.
>
> IF SYSMIS(DateVar) DateVar = date.dmy(1,1,1800).
> MISSING VALUES DateVar ("1/1/1800").
> VALUE LABELS DateVar "1/1/1800" "Missing".
> FREQUENCIES DateVar.
>
>
> Note the enclosure of the missing date value in quotes on the MISSING
VALUES
> and VALUE LABELS lines.  The following is from the FM entry for MISSING
> VALUES:
>
> * For date format variables (for example, DATE, ADATE), missing values
> expressed in date formats must be enclosed in single or double quotes,
and
> values must be expressed in the same date format as the defined date
format
> for the variable.
>
> HTH.
>
>
>
> Elizabeth Tighe wrote
>> we have a date variable formatted as (ADATE10)
>>
>> some used our traditional specific missing values when the date was
>> missing, such as -999 or -995.
>>
>> These specific missing values have value labels, such as Missing:
>> Unspecified or Missing: Not Applicable
>>
>> The frequencies for the date variable recognizes these values as
>> specific missing.  However, the values of -999 and -995 are lost. The
>> values appear in frequency tables as ".Missing: Unspecified"
>>
>> Is there a way to recode these specific missing variables back into a
>> specific missing date variable, such as
>>
>> IF (date EQ .Missing:Not Applicable) date=date.mdy(01/01/1800).
>>
>> MISSING VALUES date ("01/01/1800").
>>
>> I cannot figure out how to recode these ".Missing: Label" values.
>>
>> Any tips/tricks would be much appreciated!
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>> LISTSERV@.UGA
>>   (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
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/problem-with-missing-data-in-date-variables-tp5726334p5726337.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

--

Elizabeth Tighe, Ph.D.
Research Scientist
Steinhardt Social Research Institute
Brandeis University
781.736.3824

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: problem with missing data in date variables

Elizabeth Tighe
In reply to this post by Rick Oliver-3

thanks Rick.  not sure how to select on and use specific missing when we leave them as -999s and -998s.

I went in another direction. 

I recoded the date variable into a numeric and found that the recode not only converted all of the dates to their numeric values, but it gave me back my specific missing values of -999 thru -993.  yay!  I could then just use this numeric variable to recode the specific missing into specific missing in date formats.  e.g.,

recode date (else=copy) into numdate.
if (numdate EQ -993) date=date.mdy(01,03,1900).
if (numdate EQ -994) date=date.mdy(01,04,1900).
etc.,

missing values date (etc.)
value labels date (etc.)

many thanks guys for taking time to help think this through.





On 6/4/2014 4:23 PM, Rick Oliver wrote:
If they are recognized as different user-missing values, then the original values aren't lost, they just cannot be displayed as dates. So you just need to assign value labels to the original missing values.

data list free /datevar (adate10).
begin data
1/1/2014 2/15/2014 3/20/2014 5/1/2014
end data.
*create some values that aren't valid as date formats
to reproduce the scenario.
if datevar=date.mdy(5,1,2014) datevar=-999.
if datevar=date.mdy(3,20,2014) datevar=-998.
missing values datevar (-999, -998).
value labels datevar -999 'no answer' -998 'not applicable'.
frequencies variables=datevar.


Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]




From:        Elizabeth Tighe [hidden email]
To:        [hidden email],
Date:        06/04/2014 03:00 PM
Subject:        Re: problem with missing data in date variables
Sent by:        "SPSSX(r) Discussion" [hidden email]




all spss .sav files.  And no problem re: setting them all to some
general missing value, I can do that.  But, I'd prefer being able to
maintain the specific missing values if possible.  Since it appears the
program recognizes them as specific missing and they display in the
frequencies as specific missing, it seems a matter of figuring out how
those specific missing are represented numerically in the data maybe?

Thanks,
Liz Tighe


On 6/4/2014 3:42 PM, Bruce Weaver wrote:
> What is the source of the data--e.g., are you importing from Excel or some
> other type of non-SPSS file?  If so, you could import the date variable(s)
> in question as STRING variables initially, do whatever recoding you want to
> do, then convert the variable(s) to a date format via ALTER TYPE.
>
> If the data are already in an SPSS data file and the date variables
> formatted as date variables, you'll have the system missing value (SYSMIS)
> where things are missing.  In that case, you can still recode all of the
> missing values to some proper date value of your choosing; but you'll not be
> able to distinguish between different reasons for the missing data (i.e.,
> your -999 and -995 codes).
>
> Here's a small example.
>
> * Read in some sample data.
> NEW FILE.
> DATASET CLOSE all.
> DATA LIST list / DateVar(adate10).
> BEGIN DATA
> 6/4/2014
> 12/25/2013
> .
> END DATA.
>
> IF SYSMIS(DateVar) DateVar = date.dmy(1,1,1800).
> MISSING VALUES DateVar ("1/1/1800").
> VALUE LABELS DateVar "1/1/1800" "Missing".
> FREQUENCIES DateVar.
>
>
> Note the enclosure of the missing date value in quotes on the MISSING VALUES
> and VALUE LABELS lines.  The following is from the FM entry for MISSING
> VALUES:
>
> * For date format variables (for example, DATE, ADATE), missing values
> expressed in date formats must be enclosed in single or double quotes, and
> values must be expressed in the same date format as the defined date format
> for the variable.
>
> HTH.
>
>
>
> Elizabeth Tighe wrote
>> we have a date variable formatted as (ADATE10)
>>
>> some used our traditional specific missing values when the date was
>> missing, such as -999 or -995.
>>
>> These specific missing values have value labels, such as Missing:
>> Unspecified or Missing: Not Applicable
>>
>> The frequencies for the date variable recognizes these values as
>> specific missing.  However, the values of -999 and -995 are lost. The
>> values appear in frequency tables as ".Missing: Unspecified"
>>
>> Is there a way to recode these specific missing variables back into a
>> specific missing date variable, such as
>>
>> IF (date EQ .Missing:Not Applicable) date=date.mdy(01/01/1800).
>>
>> MISSING VALUES date ("01/01/1800").
>>
>> I cannot figure out how to recode these ".Missing: Label" values.
>>
>> Any tips/tricks would be much appreciated!
>>
>> =====================
>> 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
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
>
http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/problem-with-missing-data-in-date-variables-tp5726334p5726337.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

--

Elizabeth Tighe, Ph.D.
Research Scientist
Steinhardt Social Research Institute
Brandeis University
781.736.3824

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



--

Elizabeth Tighe, Ph.D.
Research Scientist
Steinhardt Social Research Institute
Brandeis University
781.736.3824
Reply | Threaded
Open this post in threaded view
|

Re: problem with missing data in date variables

David Marso
Administrator
In reply to this post by Elizabeth Tighe
Run and study the following!
DATA LIST /date (ADATE).
BEGIN DATA
10/12/2001
12/20/2002
.
.
END DATA.
LIST.
IF $CASENUM=3 date=-999.
IF $CASENUM=4 date=-995.
LIST.
VALUE LABELS date -999 '-999' -995 '-995'.
MISSING VALUES date (-999,-995).
FREQUENCIES ALL.
FORMATS date (F12).
LIST.




Elizabeth Tighe wrote
all spss .sav files.  And no problem re: setting them all to some
general missing value, I can do that.  But, I'd prefer being able to
maintain the specific missing values if possible.  Since it appears the
program recognizes them as specific missing and they display in the
frequencies as specific missing, it seems a matter of figuring out how
those specific missing are represented numerically in the data maybe?

Thanks,
Liz Tighe


On 6/4/2014 3:42 PM, Bruce Weaver wrote:
> What is the source of the data--e.g., are you importing from Excel or some
> other type of non-SPSS file?  If so, you could import the date variable(s)
> in question as STRING variables initially, do whatever recoding you want to
> do, then convert the variable(s) to a date format via ALTER TYPE.
>
> If the data are already in an SPSS data file and the date variables
> formatted as date variables, you'll have the system missing value (SYSMIS)
> where things are missing.  In that case, you can still recode all of the
> missing values to some proper date value of your choosing; but you'll not be
> able to distinguish between different reasons for the missing data (i.e.,
> your -999 and -995 codes).
>
> Here's a small example.
>
> * Read in some sample data.
> NEW FILE.
> DATASET CLOSE all.
> DATA LIST list / DateVar(adate10).
> BEGIN DATA
> 6/4/2014
> 12/25/2013
> .
> END DATA.
>
> IF SYSMIS(DateVar) DateVar = date.dmy(1,1,1800).
> MISSING VALUES DateVar ("1/1/1800").
> VALUE LABELS DateVar "1/1/1800" "Missing".
> FREQUENCIES DateVar.
>
>
> Note the enclosure of the missing date value in quotes on the MISSING VALUES
> and VALUE LABELS lines.  The following is from the FM entry for MISSING
> VALUES:
>
> * For date format variables (for example, DATE, ADATE), missing values
> expressed in date formats must be enclosed in single or double quotes, and
> values must be expressed in the same date format as the defined date format
> for the variable.
>
> HTH.
>
>
>
> Elizabeth Tighe wrote
>> we have a date variable formatted as (ADATE10)
>>
>> some used our traditional specific missing values when the date was
>> missing, such as -999 or -995.
>>
>> These specific missing values have value labels, such as Missing:
>> Unspecified or Missing: Not Applicable
>>
>> The frequencies for the date variable recognizes these values as
>> specific missing.  However, the values of -999 and -995 are lost. The
>> values appear in frequency tables as ".Missing: Unspecified"
>>
>> Is there a way to recode these specific missing variables back into a
>> specific missing date variable, such as
>>
>> IF (date EQ .Missing:Not Applicable) date=date.mdy(01/01/1800).
>>
>> MISSING VALUES date ("01/01/1800").
>>
>> I cannot figure out how to recode these ".Missing: Label" values.
>>
>> Any tips/tricks would be much appreciated!
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>> LISTSERV@.UGA
>>   (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
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/problem-with-missing-data-in-date-variables-tp5726334p5726337.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

--

Elizabeth Tighe, Ph.D.
Research Scientist
Steinhardt Social Research Institute
Brandeis University
781.736.3824

=====================
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: problem with missing data in date variables

Rick Oliver-3
In reply to this post by Elizabeth Tighe
I think you should still be able to select based on the original missing values.

The issue is largely a formatting issue. Numbers less than 86400 cannot be displayed as dates, but something like this should still work:

select if datevar=-999

or

select if datevar < 0

Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]




From:        Elizabeth Tighe <[hidden email]>
To:        Rick Oliver/Chicago/IBM@IBMUS,
Cc:        [hidden email]
Date:        06/04/2014 03:52 PM
Subject:        Re: problem with missing data in date variables





thanks Rick.  not sure how to select on and use specific missing when we leave them as -999s and -998s.

I went in another direction.  

I recoded the date variable into a numeric and found that the recode not only converted all of the dates to their numeric values, but it gave me back my specific missing values of -999 thru -993.  yay!  I could then just use this numeric variable to recode the specific missing into specific missing in date formats.  e.g.,

recode date (else=copy) into numdate.
if (numdate EQ -993) date=date.mdy(01,03,1900).
if (numdate EQ -994) date=date.mdy(01,04,1900).
etc.,

missing values date (etc.)
value labels date (etc.)

many thanks guys for taking time to help think this through.





On 6/4/2014 4:23 PM, Rick Oliver wrote:
If they are recognized as different user-missing values, then the original values aren't lost, they just cannot be displayed as dates. So you just need to assign value labels to the original missing values.

data list free /datevar (adate10).

begin data

1/1/2014 2/15/2014 3/20/2014 5/1/2014

end data.

*create some values that aren't valid as date formats

to reproduce the scenario.

if datevar=date.mdy(5,1,2014) datevar=-999.

if datevar=date.mdy(3,20,2014) datevar=-998.

missing values datevar (-999, -998).

value labels datevar -999 'no answer' -998 'not applicable'.

frequencies variables=datevar.



Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail:
oliverr@...



From:        
Elizabeth Tighe <tighe@...>
To:        
[hidden email],
Date:        
06/04/2014 03:00 PM
Subject:        
Re: problem with missing data in date variables
Sent by:        
"SPSSX(r) Discussion" [hidden email]




all spss .sav files.  And no problem re: setting them all to some
general missing value, I can do that.  But, I'd prefer being able to
maintain the specific missing values if possible.  Since it appears the
program recognizes them as specific missing and they display in the
frequencies as specific missing, it seems a matter of figuring out how
those specific missing are represented numerically in the data maybe?

Thanks,
Liz Tighe


On 6/4/2014 3:42 PM, Bruce Weaver wrote:
> What is the source of the data--e.g., are you importing from Excel or some
> other type of non-SPSS file?  If so, you could import the date variable(s)
> in question as STRING variables initially, do whatever recoding you want to
> do, then convert the variable(s) to a date format via ALTER TYPE.
>
> If the data are already in an SPSS data file and the date variables
> formatted as date variables, you'll have the system missing value (SYSMIS)
> where things are missing.  In that case, you can still recode all of the
> missing values to some proper date value of your choosing; but you'll not be
> able to distinguish between different reasons for the missing data (i.e.,
> your -999 and -995 codes).
>
> Here's a small example.
>
> * Read in some sample data.
> NEW FILE.
> DATASET CLOSE all.
> DATA LIST list / DateVar(adate10).
> BEGIN DATA
> 6/4/2014
> 12/25/2013
> .
> END DATA.
>
> IF SYSMIS(DateVar) DateVar = date.dmy(1,1,1800).
> MISSING VALUES DateVar ("1/1/1800").
> VALUE LABELS DateVar "1/1/1800" "Missing".
> FREQUENCIES DateVar.
>
>
> Note the enclosure of the missing date value in quotes on the MISSING VALUES
> and VALUE LABELS lines.  The following is from the FM entry for MISSING
> VALUES:
>
> * For date format variables (for example, DATE, ADATE), missing values
> expressed in date formats must be enclosed in single or double quotes, and
> values must be expressed in the same date format as the defined date format
> for the variable.
>
> HTH.
>
>
>
> Elizabeth Tighe wrote
>> we have a date variable formatted as (ADATE10)
>>
>> some used our traditional specific missing values when the date was
>> missing, such as -999 or -995.
>>
>> These specific missing values have value labels, such as Missing:
>> Unspecified or Missing: Not Applicable
>>
>> The frequencies for the date variable recognizes these values as
>> specific missing.  However, the values of -999 and -995 are lost. The
>> values appear in frequency tables as ".Missing: Unspecified"
>>
>> Is there a way to recode these specific missing variables back into a
>> specific missing date variable, such as
>>
>> IF (date EQ .Missing:Not Applicable) date=date.mdy(01/01/1800).
>>
>> MISSING VALUES date ("01/01/1800").
>>
>> I cannot figure out how to recode these ".Missing: Label" values.
>>
>> Any tips/tricks would be much appreciated!
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>>
LISTSERV@.UGA
>>   (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
>
>
>
>
> -----
> --
> Bruce Weaver
>
bweaver@...
>
http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/problem-with-missing-data-in-date-variables-tp5726334p5726337.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
>
LISTSERV@... (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

--

Elizabeth Tighe, Ph.D.
Research Scientist
Steinhardt Social Research Institute
Brandeis University
781.736.3824

=====================
To manage your subscription to SPSSX-L, send a message to

LISTSERV@... (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



--

Elizabeth Tighe, Ph.D.
Research Scientist
Steinhardt Social Research Institute
Brandeis University
781.736.3824

Reply | Threaded
Open this post in threaded view
|

Re: problem with missing data in date variables

Rick Oliver-3
In reply to this post by Elizabeth Tighe
Oops. Since they're defined as missing:

select if value(datevar)=-999.

Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]




From:        Rick Oliver/Chicago/IBM
To:        Elizabeth Tighe <[hidden email]>,
Cc:        [hidden email]
Date:        06/04/2014 03:56 PM
Subject:        Re: problem with missing data in date variables



I think you should still be able to select based on the original missing values.

The issue is largely a formatting issue. Numbers less than 86400 cannot be displayed as dates, but something like this should still work:

select if datevar=-999

or

select if datevar < 0

Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]





From:        Elizabeth Tighe <[hidden email]>
To:        Rick Oliver/Chicago/IBM@IBMUS,
Cc:        [hidden email]
Date:        06/04/2014 03:52 PM
Subject:        Re: problem with missing data in date variables





thanks Rick.  not sure how to select on and use specific missing when we leave them as -999s and -998s.

I went in another direction.  

I recoded the date variable into a numeric and found that the recode not only converted all of the dates to their numeric values, but it gave me back my specific missing values of -999 thru -993.  yay!  I could then just use this numeric variable to recode the specific missing into specific missing in date formats.  e.g.,

recode date (else=copy) into numdate.
if (numdate EQ -993) date=date.mdy(01,03,1900).
if (numdate EQ -994) date=date.mdy(01,04,1900).
etc.,

missing values date (etc.)
value labels date (etc.)

many thanks guys for taking time to help think this through.





On 6/4/2014 4:23 PM, Rick Oliver wrote:
If they are recognized as different user-missing values, then the original values aren't lost, they just cannot be displayed as dates. So you just need to assign value labels to the original missing values.

data list free /datevar (adate10).

begin data

1/1/2014 2/15/2014 3/20/2014 5/1/2014

end data.

*create some values that aren't valid as date formats

to reproduce the scenario.

if datevar=date.mdy(5,1,2014) datevar=-999.

if datevar=date.mdy(3,20,2014) datevar=-998.

missing values datevar (-999, -998).

value labels datevar -999 'no answer' -998 'not applicable'.

frequencies variables=datevar.



Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail:
oliverr@...



From:        
Elizabeth Tighe <tighe@...>
To:        
[hidden email],
Date:        
06/04/2014 03:00 PM
Subject:        
Re: problem with missing data in date variables
Sent by:        
"SPSSX(r) Discussion" [hidden email]




all spss .sav files.  And no problem re: setting them all to some
general missing value, I can do that.  But, I'd prefer being able to
maintain the specific missing values if possible.  Since it appears the
program recognizes them as specific missing and they display in the
frequencies as specific missing, it seems a matter of figuring out how
those specific missing are represented numerically in the data maybe?

Thanks,
Liz Tighe


On 6/4/2014 3:42 PM, Bruce Weaver wrote:
> What is the source of the data--e.g., are you importing from Excel or some
> other type of non-SPSS file?  If so, you could import the date variable(s)
> in question as STRING variables initially, do whatever recoding you want to
> do, then convert the variable(s) to a date format via ALTER TYPE.
>
> If the data are already in an SPSS data file and the date variables
> formatted as date variables, you'll have the system missing value (SYSMIS)
> where things are missing.  In that case, you can still recode all of the
> missing values to some proper date value of your choosing; but you'll not be
> able to distinguish between different reasons for the missing data (i.e.,
> your -999 and -995 codes).
>
> Here's a small example.
>
> * Read in some sample data.
> NEW FILE.
> DATASET CLOSE all.
> DATA LIST list / DateVar(adate10).
> BEGIN DATA
> 6/4/2014
> 12/25/2013
> .
> END DATA.
>
> IF SYSMIS(DateVar) DateVar = date.dmy(1,1,1800).
> MISSING VALUES DateVar ("1/1/1800").
> VALUE LABELS DateVar "1/1/1800" "Missing".
> FREQUENCIES DateVar.
>
>
> Note the enclosure of the missing date value in quotes on the MISSING VALUES
> and VALUE LABELS lines.  The following is from the FM entry for MISSING
> VALUES:
>
> * For date format variables (for example, DATE, ADATE), missing values
> expressed in date formats must be enclosed in single or double quotes, and
> values must be expressed in the same date format as the defined date format
> for the variable.
>
> HTH.
>
>
>
> Elizabeth Tighe wrote
>> we have a date variable formatted as (ADATE10)
>>
>> some used our traditional specific missing values when the date was
>> missing, such as -999 or -995.
>>
>> These specific missing values have value labels, such as Missing:
>> Unspecified or Missing: Not Applicable
>>
>> The frequencies for the date variable recognizes these values as
>> specific missing.  However, the values of -999 and -995 are lost. The
>> values appear in frequency tables as ".Missing: Unspecified"
>>
>> Is there a way to recode these specific missing variables back into a
>> specific missing date variable, such as
>>
>> IF (date EQ .Missing:Not Applicable) date=date.mdy(01/01/1800).
>>
>> MISSING VALUES date ("01/01/1800").
>>
>> I cannot figure out how to recode these ".Missing: Label" values.
>>
>> Any tips/tricks would be much appreciated!
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>>
LISTSERV@.UGA
>>   (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
>
>
>
>
> -----
> --
> Bruce Weaver
>
bweaver@...
>
http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/problem-with-missing-data-in-date-variables-tp5726334p5726337.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
>
LISTSERV@... (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

--

Elizabeth Tighe, Ph.D.
Research Scientist
Steinhardt Social Research Institute
Brandeis University
781.736.3824

=====================
To manage your subscription to SPSSX-L, send a message to

LISTSERV@... (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



--

Elizabeth Tighe, Ph.D.
Research Scientist
Steinhardt Social Research Institute
Brandeis University
781.736.3824

Reply | Threaded
Open this post in threaded view
|

Re: problem with missing data in date variables

Elizabeth Tighe
In reply to this post by Bruce Weaver
thanks, we generate a date variable by combining variables of interview
month, interview day and interview year (compute
date=date.mdy(mon,day,year).   it's not a single data collection. we
combine data across 100s of surveys so dates can be missing for any
number of reasons.

when computing the date variable, coders coded the missing using
specific numeric values, so even though the date is formatted as a date
variable, the discrete numeric values of -999 thru -993 are being
stored.  But they don't appear as -999 thru -993 in the data view or in
things like frequency tables.  It makes it hard to keep track of when
checking data to have to keep going back and forth to documentation to
check on what values those cases were actually coded as.

And you're correct Rick.  I originally couldn't select because I
couldn't see what values each label went with so I wasn't sure how it
had stored the -999s.  It just makes it easier to work with the data to
be able to see values and labels consistently.

Thanks again,
Liz


On 6/4/2014 4:34 PM, Bruce Weaver wrote:

> Can you generate a small dataset that illustrates the problem?  E.g.,
>
> DATA LIST list / DateVar(ADATE10).
> BEGIN DATA
> { fill in 8 or 10 of your date values here, one per row, including the
> various missing values }
> END DATA.
>
> I'm not understanding what the values are on cases that have your two (or
> more) distinct missing values.  If it is a true date variable, they cannot
> be -999 and -995, for example.  Sorry if I'm just being obtuse.
>
>
>
> Elizabeth Tighe wrote
>> all spss .sav files.  And no problem re: setting them all to some
>> general missing value, I can do that.  But, I'd prefer being able to
>> maintain the specific missing values if possible.  Since it appears the
>> program recognizes them as specific missing and they display in the
>> frequencies as specific missing, it seems a matter of figuring out how
>> those specific missing are represented numerically in the data maybe?
>>
>> Thanks,
>> Liz Tighe
>>
>>
>> On 6/4/2014 3:42 PM, Bruce Weaver wrote:
>>> What is the source of the data--e.g., are you importing from Excel or
>>> some
>>> other type of non-SPSS file?  If so, you could import the date
>>> variable(s)
>>> in question as STRING variables initially, do whatever recoding you want
>>> to
>>> do, then convert the variable(s) to a date format via ALTER TYPE.
>>>
>>> If the data are already in an SPSS data file and the date variables
>>> formatted as date variables, you'll have the system missing value
>>> (SYSMIS)
>>> where things are missing.  In that case, you can still recode all of the
>>> missing values to some proper date value of your choosing; but you'll not
>>> be
>>> able to distinguish between different reasons for the missing data (i.e.,
>>> your -999 and -995 codes).
>>>
>>> Here's a small example.
>>>
>>> * Read in some sample data.
>>> NEW FILE.
>>> DATASET CLOSE all.
>>> DATA LIST list / DateVar(adate10).
>>> BEGIN DATA
>>> 6/4/2014
>>> 12/25/2013
>>> .
>>> END DATA.
>>>
>>> IF SYSMIS(DateVar) DateVar = date.dmy(1,1,1800).
>>> MISSING VALUES DateVar ("1/1/1800").
>>> VALUE LABELS DateVar "1/1/1800" "Missing".
>>> FREQUENCIES DateVar.
>>>
>>>
>>> Note the enclosure of the missing date value in quotes on the MISSING
>>> VALUES
>>> and VALUE LABELS lines.  The following is from the FM entry for MISSING
>>> VALUES:
>>>
>>> * For date format variables (for example, DATE, ADATE), missing values
>>> expressed in date formats must be enclosed in single or double quotes,
>>> and
>>> values must be expressed in the same date format as the defined date
>>> format
>>> for the variable.
>>>
>>> HTH.
>>>
>>>
>>>
>>> Elizabeth Tighe wrote
>>>> we have a date variable formatted as (ADATE10)
>>>>
>>>> some used our traditional specific missing values when the date was
>>>> missing, such as -999 or -995.
>>>>
>>>> These specific missing values have value labels, such as Missing:
>>>> Unspecified or Missing: Not Applicable
>>>>
>>>> The frequencies for the date variable recognizes these values as
>>>> specific missing.  However, the values of -999 and -995 are lost. The
>>>> values appear in frequency tables as ".Missing: Unspecified"
>>>>
>>>> Is there a way to recode these specific missing variables back into a
>>>> specific missing date variable, such as
>>>>
>>>> IF (date EQ .Missing:Not Applicable) date=date.mdy(01/01/1800).
>>>>
>>>> MISSING VALUES date ("01/01/1800").
>>>>
>>>> I cannot figure out how to recode these ".Missing: Label" values.
>>>>
>>>> Any tips/tricks would be much appreciated!
>>>>
>>>> =====================
>>>> To manage your subscription to SPSSX-L, send a message to
>>>> LISTSERV@.UGA
>>>>    (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
>>>
>>>
>>>
>>> -----
>>> --
>>> Bruce Weaver
>>>
>> bweaver@
>>> http://sites.google.com/a/lakeheadu.ca/bweaver/
>>>
>>> "When all else fails, RTFM."
>>>
>>> NOTE: My Hotmail account is not monitored regularly.
>>> To send me an e-mail, please use the address shown above.
>>>
>>> --
>>> View this message in context:
>>> http://spssx-discussion.1045642.n5.nabble.com/problem-with-missing-data-in-date-variables-tp5726334p5726337.html
>>> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>>
>>> =====================
>>> To manage your subscription to SPSSX-L, send a message to
>>>
>> LISTSERV@.UGA
>>   (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
>> --
>>
>> Elizabeth Tighe, Ph.D.
>> Research Scientist
>> Steinhardt Social Research Institute
>> Brandeis University
>> 781.736.3824
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>> LISTSERV@.UGA
>>   (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
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/problem-with-missing-data-in-date-variables-tp5726334p5726340.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

--

Elizabeth Tighe, Ph.D.
Research Scientist
Steinhardt Social Research Institute
Brandeis University
781.736.3824

=====================
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: problem with missing data in date variables

Bruce Weaver
Administrator
In reply to this post by David Marso
Let me suggest a small modification that highlights one of the things that has me scratching my head a bit.

* Marso syntax.

DATA LIST /date (ADATE).
BEGIN DATA
10/12/2001
12/20/2002
.
.
END DATA.
LIST.
IF $CASENUM=3 date=-999.
IF $CASENUM=4 date=-995.
LIST.
VALUE LABELS date -999 '-999' -995 '-995'.
MISSING VALUES date (-999,-995).
FREQUENCIES ALL.
*********************************.
* NEXT LINE ADDED TO DM's SYNTAX.
*********************************.
COMPUTE x = date.
FORMATS date x (F12). /* Format x as F12 too.
LIST.

Output from the final LIST:

        date            x
 
 13222224000  13222224000
 13259721600  13259721600
        -999            .
        -995            .
 
Number of cases read:  4    Number of cases listed:  4

So even though the -999 and -995 are there in the date variable, they are not there in x.  Why not?




David Marso wrote
Run and study the following!
DATA LIST /date (ADATE).
BEGIN DATA
10/12/2001
12/20/2002
.
.
END DATA.
LIST.
IF $CASENUM=3 date=-999.
IF $CASENUM=4 date=-995.
LIST.
VALUE LABELS date -999 '-999' -995 '-995'.
MISSING VALUES date (-999,-995).
FREQUENCIES ALL.
FORMATS date (F12).
LIST.




Elizabeth Tighe wrote
all spss .sav files.  And no problem re: setting them all to some
general missing value, I can do that.  But, I'd prefer being able to
maintain the specific missing values if possible.  Since it appears the
program recognizes them as specific missing and they display in the
frequencies as specific missing, it seems a matter of figuring out how
those specific missing are represented numerically in the data maybe?

Thanks,
Liz Tighe


On 6/4/2014 3:42 PM, Bruce Weaver wrote:
> What is the source of the data--e.g., are you importing from Excel or some
> other type of non-SPSS file?  If so, you could import the date variable(s)
> in question as STRING variables initially, do whatever recoding you want to
> do, then convert the variable(s) to a date format via ALTER TYPE.
>
> If the data are already in an SPSS data file and the date variables
> formatted as date variables, you'll have the system missing value (SYSMIS)
> where things are missing.  In that case, you can still recode all of the
> missing values to some proper date value of your choosing; but you'll not be
> able to distinguish between different reasons for the missing data (i.e.,
> your -999 and -995 codes).
>
> Here's a small example.
>
> * Read in some sample data.
> NEW FILE.
> DATASET CLOSE all.
> DATA LIST list / DateVar(adate10).
> BEGIN DATA
> 6/4/2014
> 12/25/2013
> .
> END DATA.
>
> IF SYSMIS(DateVar) DateVar = date.dmy(1,1,1800).
> MISSING VALUES DateVar ("1/1/1800").
> VALUE LABELS DateVar "1/1/1800" "Missing".
> FREQUENCIES DateVar.
>
>
> Note the enclosure of the missing date value in quotes on the MISSING VALUES
> and VALUE LABELS lines.  The following is from the FM entry for MISSING
> VALUES:
>
> * For date format variables (for example, DATE, ADATE), missing values
> expressed in date formats must be enclosed in single or double quotes, and
> values must be expressed in the same date format as the defined date format
> for the variable.
>
> HTH.
>
>
>
> Elizabeth Tighe wrote
>> we have a date variable formatted as (ADATE10)
>>
>> some used our traditional specific missing values when the date was
>> missing, such as -999 or -995.
>>
>> These specific missing values have value labels, such as Missing:
>> Unspecified or Missing: Not Applicable
>>
>> The frequencies for the date variable recognizes these values as
>> specific missing.  However, the values of -999 and -995 are lost. The
>> values appear in frequency tables as ".Missing: Unspecified"
>>
>> Is there a way to recode these specific missing variables back into a
>> specific missing date variable, such as
>>
>> IF (date EQ .Missing:Not Applicable) date=date.mdy(01/01/1800).
>>
>> MISSING VALUES date ("01/01/1800").
>>
>> I cannot figure out how to recode these ".Missing: Label" values.
>>
>> Any tips/tricks would be much appreciated!
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>> LISTSERV@.UGA
>>   (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
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/problem-with-missing-data-in-date-variables-tp5726334p5726337.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

--

Elizabeth Tighe, Ph.D.
Research Scientist
Steinhardt Social Research Institute
Brandeis University
781.736.3824

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: problem with missing data in date variables

David Marso
Administrator
It's the User missing values.
Consider:
DATA LIST /date (ADATE).
BEGIN DATA
10/12/2001
12/20/2002
.
.
END DATA.
LIST.
IF $CASENUM=3 date=-999.
IF $CASENUM=4 date=-995.
LIST.
VALUE LABELS date -999 '-999' -995 '-995'.
MISSING VALUES date (-999,-995).
FREQUENCIES ALL.
FORMATS date (F12).
RECODE date (ELSE=COPY) INTO newdate.
COMPUTE missdate=date.
EXECUTE.
MISSING VALUES date ().
COMPUTE date2=date.
LIST.

      date  newdate missdate    date2
 
 13222224000 1.3E+010 1.3E+010 1.3E+010
 13259721600 1.3E+010 1.3E+010 1.3E+010
        -999  -999.00      .    -999.00
        -995  -995.00      .    -995.00
 
 
Number of cases read:  4    Number of cases listed:  4

Bruce Weaver wrote
Let me suggest a small modification that highlights one of the things that has me scratching my head a bit.

* Marso syntax.

DATA LIST /date (ADATE).
BEGIN DATA
10/12/2001
12/20/2002
.
.
END DATA.
LIST.
IF $CASENUM=3 date=-999.
IF $CASENUM=4 date=-995.
LIST.
VALUE LABELS date -999 '-999' -995 '-995'.
MISSING VALUES date (-999,-995).
FREQUENCIES ALL.
*********************************.
* NEXT LINE ADDED TO DM's SYNTAX.
*********************************.
COMPUTE x = date.
FORMATS date x (F12). /* Format x as F12 too.
LIST.

Output from the final LIST:

        date            x
 
 13222224000  13222224000
 13259721600  13259721600
        -999            .
        -995            .
 
Number of cases read:  4    Number of cases listed:  4

So even though the -999 and -995 are there in the date variable, they are not there in x.  Why not?




David Marso wrote
Run and study the following!
DATA LIST /date (ADATE).
BEGIN DATA
10/12/2001
12/20/2002
.
.
END DATA.
LIST.
IF $CASENUM=3 date=-999.
IF $CASENUM=4 date=-995.
LIST.
VALUE LABELS date -999 '-999' -995 '-995'.
MISSING VALUES date (-999,-995).
FREQUENCIES ALL.
FORMATS date (F12).
LIST.




Elizabeth Tighe wrote
all spss .sav files.  And no problem re: setting them all to some
general missing value, I can do that.  But, I'd prefer being able to
maintain the specific missing values if possible.  Since it appears the
program recognizes them as specific missing and they display in the
frequencies as specific missing, it seems a matter of figuring out how
those specific missing are represented numerically in the data maybe?

Thanks,
Liz Tighe


On 6/4/2014 3:42 PM, Bruce Weaver wrote:
> What is the source of the data--e.g., are you importing from Excel or some
> other type of non-SPSS file?  If so, you could import the date variable(s)
> in question as STRING variables initially, do whatever recoding you want to
> do, then convert the variable(s) to a date format via ALTER TYPE.
>
> If the data are already in an SPSS data file and the date variables
> formatted as date variables, you'll have the system missing value (SYSMIS)
> where things are missing.  In that case, you can still recode all of the
> missing values to some proper date value of your choosing; but you'll not be
> able to distinguish between different reasons for the missing data (i.e.,
> your -999 and -995 codes).
>
> Here's a small example.
>
> * Read in some sample data.
> NEW FILE.
> DATASET CLOSE all.
> DATA LIST list / DateVar(adate10).
> BEGIN DATA
> 6/4/2014
> 12/25/2013
> .
> END DATA.
>
> IF SYSMIS(DateVar) DateVar = date.dmy(1,1,1800).
> MISSING VALUES DateVar ("1/1/1800").
> VALUE LABELS DateVar "1/1/1800" "Missing".
> FREQUENCIES DateVar.
>
>
> Note the enclosure of the missing date value in quotes on the MISSING VALUES
> and VALUE LABELS lines.  The following is from the FM entry for MISSING
> VALUES:
>
> * For date format variables (for example, DATE, ADATE), missing values
> expressed in date formats must be enclosed in single or double quotes, and
> values must be expressed in the same date format as the defined date format
> for the variable.
>
> HTH.
>
>
>
> Elizabeth Tighe wrote
>> we have a date variable formatted as (ADATE10)
>>
>> some used our traditional specific missing values when the date was
>> missing, such as -999 or -995.
>>
>> These specific missing values have value labels, such as Missing:
>> Unspecified or Missing: Not Applicable
>>
>> The frequencies for the date variable recognizes these values as
>> specific missing.  However, the values of -999 and -995 are lost. The
>> values appear in frequency tables as ".Missing: Unspecified"
>>
>> Is there a way to recode these specific missing variables back into a
>> specific missing date variable, such as
>>
>> IF (date EQ .Missing:Not Applicable) date=date.mdy(01/01/1800).
>>
>> MISSING VALUES date ("01/01/1800").
>>
>> I cannot figure out how to recode these ".Missing: Label" values.
>>
>> Any tips/tricks would be much appreciated!
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>> LISTSERV@.UGA
>>   (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
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/problem-with-missing-data-in-date-variables-tp5726334p5726337.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

--

Elizabeth Tighe, Ph.D.
Research Scientist
Steinhardt Social Research Institute
Brandeis University
781.736.3824

=====================
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: problem with missing data in date variables

Bruce Weaver
Administrator
D'oh!  So it is!  Blindingly obvious now that you've said it!  (Nabble needs a "hanging-head-in-shame" emoticon for times like this.)  


David Marso wrote
It's the User missing values.
Consider:
DATA LIST /date (ADATE).
BEGIN DATA
10/12/2001
12/20/2002
.
.
END DATA.
LIST.
IF $CASENUM=3 date=-999.
IF $CASENUM=4 date=-995.
LIST.
VALUE LABELS date -999 '-999' -995 '-995'.
MISSING VALUES date (-999,-995).
FREQUENCIES ALL.
FORMATS date (F12).
RECODE date (ELSE=COPY) INTO newdate.
COMPUTE missdate=date.
EXECUTE.
MISSING VALUES date ().
COMPUTE date2=date.
LIST.

      date  newdate missdate    date2
 
 13222224000 1.3E+010 1.3E+010 1.3E+010
 13259721600 1.3E+010 1.3E+010 1.3E+010
        -999  -999.00      .    -999.00
        -995  -995.00      .    -995.00
 
 
Number of cases read:  4    Number of cases listed:  4

Bruce Weaver wrote
Let me suggest a small modification that highlights one of the things that has me scratching my head a bit.

* Marso syntax.

DATA LIST /date (ADATE).
BEGIN DATA
10/12/2001
12/20/2002
.
.
END DATA.
LIST.
IF $CASENUM=3 date=-999.
IF $CASENUM=4 date=-995.
LIST.
VALUE LABELS date -999 '-999' -995 '-995'.
MISSING VALUES date (-999,-995).
FREQUENCIES ALL.
*********************************.
* NEXT LINE ADDED TO DM's SYNTAX.
*********************************.
COMPUTE x = date.
FORMATS date x (F12). /* Format x as F12 too.
LIST.

Output from the final LIST:

        date            x
 
 13222224000  13222224000
 13259721600  13259721600
        -999            .
        -995            .
 
Number of cases read:  4    Number of cases listed:  4

So even though the -999 and -995 are there in the date variable, they are not there in x.  Why not?




David Marso wrote
Run and study the following!
DATA LIST /date (ADATE).
BEGIN DATA
10/12/2001
12/20/2002
.
.
END DATA.
LIST.
IF $CASENUM=3 date=-999.
IF $CASENUM=4 date=-995.
LIST.
VALUE LABELS date -999 '-999' -995 '-995'.
MISSING VALUES date (-999,-995).
FREQUENCIES ALL.
FORMATS date (F12).
LIST.




Elizabeth Tighe wrote
all spss .sav files.  And no problem re: setting them all to some
general missing value, I can do that.  But, I'd prefer being able to
maintain the specific missing values if possible.  Since it appears the
program recognizes them as specific missing and they display in the
frequencies as specific missing, it seems a matter of figuring out how
those specific missing are represented numerically in the data maybe?

Thanks,
Liz Tighe


On 6/4/2014 3:42 PM, Bruce Weaver wrote:
> What is the source of the data--e.g., are you importing from Excel or some
> other type of non-SPSS file?  If so, you could import the date variable(s)
> in question as STRING variables initially, do whatever recoding you want to
> do, then convert the variable(s) to a date format via ALTER TYPE.
>
> If the data are already in an SPSS data file and the date variables
> formatted as date variables, you'll have the system missing value (SYSMIS)
> where things are missing.  In that case, you can still recode all of the
> missing values to some proper date value of your choosing; but you'll not be
> able to distinguish between different reasons for the missing data (i.e.,
> your -999 and -995 codes).
>
> Here's a small example.
>
> * Read in some sample data.
> NEW FILE.
> DATASET CLOSE all.
> DATA LIST list / DateVar(adate10).
> BEGIN DATA
> 6/4/2014
> 12/25/2013
> .
> END DATA.
>
> IF SYSMIS(DateVar) DateVar = date.dmy(1,1,1800).
> MISSING VALUES DateVar ("1/1/1800").
> VALUE LABELS DateVar "1/1/1800" "Missing".
> FREQUENCIES DateVar.
>
>
> Note the enclosure of the missing date value in quotes on the MISSING VALUES
> and VALUE LABELS lines.  The following is from the FM entry for MISSING
> VALUES:
>
> * For date format variables (for example, DATE, ADATE), missing values
> expressed in date formats must be enclosed in single or double quotes, and
> values must be expressed in the same date format as the defined date format
> for the variable.
>
> HTH.
>
>
>
> Elizabeth Tighe wrote
>> we have a date variable formatted as (ADATE10)
>>
>> some used our traditional specific missing values when the date was
>> missing, such as -999 or -995.
>>
>> These specific missing values have value labels, such as Missing:
>> Unspecified or Missing: Not Applicable
>>
>> The frequencies for the date variable recognizes these values as
>> specific missing.  However, the values of -999 and -995 are lost. The
>> values appear in frequency tables as ".Missing: Unspecified"
>>
>> Is there a way to recode these specific missing variables back into a
>> specific missing date variable, such as
>>
>> IF (date EQ .Missing:Not Applicable) date=date.mdy(01/01/1800).
>>
>> MISSING VALUES date ("01/01/1800").
>>
>> I cannot figure out how to recode these ".Missing: Label" values.
>>
>> Any tips/tricks would be much appreciated!
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>> LISTSERV@.UGA
>>   (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
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/problem-with-missing-data-in-date-variables-tp5726334p5726337.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

--

Elizabeth Tighe, Ph.D.
Research Scientist
Steinhardt Social Research Institute
Brandeis University
781.736.3824

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: problem with missing data in date variables

David Marso
Administrator
Maybe a grasshopper icon ;-)


On Wed, Jun 4, 2014 at 6:48 PM, Bruce Weaver [via SPSSX Discussion] <[hidden email]> wrote:
D'oh!  So it is!  Blindingly obvious now that you've said it!  (Nabble needs a "hanging-head-in-shame" emoticon for times like this.)  


David Marso wrote
It's the User missing values.
Consider:
DATA LIST /date (ADATE).
BEGIN DATA
10/12/2001
12/20/2002
.
.
END DATA.
LIST.
IF $CASENUM=3 date=-999.
IF $CASENUM=4 date=-995.
LIST.
VALUE LABELS date -999 '-999' -995 '-995'.
MISSING VALUES date (-999,-995).
FREQUENCIES ALL.
FORMATS date (F12).
RECODE date (ELSE=COPY) INTO newdate.
COMPUTE missdate=date.
EXECUTE.
MISSING VALUES date ().
COMPUTE date2=date.
LIST.

      date  newdate missdate    date2
 
 13222224000 1.3E+010 1.3E+010 1.3E+010
 <a href="tel:13259721600" value="+13259721600" target="_blank">13259721600 1.3E+010 1.3E+010 1.3E+010
        -999  -999.00      .    -999.00
        -995  -995.00      .    -995.00
 
 
Number of cases read:  4    Number of cases listed:  4

Bruce Weaver wrote
Let me suggest a small modification that highlights one of the things that has me scratching my head a bit.

* Marso syntax.

DATA LIST /date (ADATE).
BEGIN DATA
10/12/2001
12/20/2002
.
.
END DATA.
LIST.
IF $CASENUM=3 date=-999.
IF $CASENUM=4 date=-995.
LIST.
VALUE LABELS date -999 '-999' -995 '-995'.
MISSING VALUES date (-999,-995).
FREQUENCIES ALL.
*********************************.
* NEXT LINE ADDED TO DM's SYNTAX.
*********************************.
COMPUTE x = date.
FORMATS date x (F12). /* Format x as F12 too.
LIST.

Output from the final LIST:

        date            x
 
 13222224000  13222224000
 <a href="tel:13259721600" value="+13259721600" target="_blank">13259721600  <a href="tel:13259721600" value="+13259721600" target="_blank">13259721600
        -999            .
        -995            .
 
Number of cases read:  4    Number of cases listed:  4

So even though the -999 and -995 are there in the date variable, they are not there in x.  Why not?




David Marso wrote
Run and study the following!
DATA LIST /date (ADATE).
BEGIN DATA
10/12/2001
12/20/2002
.
.
END DATA.
LIST.
IF $CASENUM=3 date=-999.
IF $CASENUM=4 date=-995.
LIST.
VALUE LABELS date -999 '-999' -995 '-995'.
MISSING VALUES date (-999,-995).
FREQUENCIES ALL.
FORMATS date (F12).
LIST.




Elizabeth Tighe wrote
all spss .sav files.  And no problem re: setting them all to some
general missing value, I can do that.  But, I'd prefer being able to
maintain the specific missing values if possible.  Since it appears the
program recognizes them as specific missing and they display in the
frequencies as specific missing, it seems a matter of figuring out how
those specific missing are represented numerically in the data maybe?

Thanks,
Liz Tighe


On 6/4/2014 3:42 PM, Bruce Weaver wrote:

> What is the source of the data--e.g., are you importing from Excel or some
> other type of non-SPSS file?  If so, you could import the date variable(s)
> in question as STRING variables initially, do whatever recoding you want to
> do, then convert the variable(s) to a date format via ALTER TYPE.
>
> If the data are already in an SPSS data file and the date variables
> formatted as date variables, you'll have the system missing value (SYSMIS)
> where things are missing.  In that case, you can still recode all of the
> missing values to some proper date value of your choosing; but you'll not be
> able to distinguish between different reasons for the missing data (i.e.,
> your -999 and -995 codes).
>
> Here's a small example.
>
> * Read in some sample data.
> NEW FILE.
> DATASET CLOSE all.
> DATA LIST list / DateVar(adate10).
> BEGIN DATA
> 6/4/2014
> 12/25/2013
> .
> END DATA.
>
> IF SYSMIS(DateVar) DateVar = date.dmy(1,1,1800).
> MISSING VALUES DateVar ("1/1/1800").
> VALUE LABELS DateVar "1/1/1800" "Missing".
> FREQUENCIES DateVar.
>
>
> Note the enclosure of the missing date value in quotes on the MISSING VALUES
> and VALUE LABELS lines.  The following is from the FM entry for MISSING
> VALUES:
>
> * For date format variables (for example, DATE, ADATE), missing values
> expressed in date formats must be enclosed in single or double quotes, and
> values must be expressed in the same date format as the defined date format
> for the variable.
>
> HTH.
>
>
>
> Elizabeth Tighe wrote
>> we have a date variable formatted as (ADATE10)
>>
>> some used our traditional specific missing values when the date was
>> missing, such as -999 or -995.
>>
>> These specific missing values have value labels, such as Missing:
>> Unspecified or Missing: Not Applicable
>>
>> The frequencies for the date variable recognizes these values as
>> specific missing.  However, the values of -999 and -995 are lost. The
>> values appear in frequency tables as ".Missing: Unspecified"
>>
>> Is there a way to recode these specific missing variables back into a
>> specific missing date variable, such as
>>
>> IF (date EQ .Missing:Not Applicable) date=date.mdy(01/01/1800).
>>
>> MISSING VALUES date ("01/01/1800").
>>
>> I cannot figure out how to recode these ".Missing: Label" values.
>>
>> Any tips/tricks would be much appreciated!
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>> LISTSERV@.UGA
>>   (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
>
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/problem-with-missing-data-in-date-variables-tp5726334p5726337.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

--

Elizabeth Tighe, Ph.D.
Research Scientist
Steinhardt Social Research Institute
Brandeis University
<a href="tel:781.736.3824" value="+17817363824" target="_blank">781.736.3824

=====================
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
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.



If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/problem-with-missing-data-in-date-variables-tp5726334p5726350.html
To unsubscribe from problem with missing data in date variables, click here.
NAML

Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: problem with missing data in date variables

Rick Oliver-3
In reply to this post by Bruce Weaver
Well, the simple answer (although it might not necessarily make much sense) is that if it's currently assigned a date format, you cannot assign it a value less than 86400. You'll get a warning that it was set to sysmis.

If you change the format to F, assign the value, and then change the format back to date, the new value sticks (although as long as the display format is date, it will still display as sysmis).

Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]




From:        Bruce Weaver <[hidden email]>
To:        [hidden email],
Date:        06/04/2014 04:53 PM
Subject:        Re: problem with missing data in date variables
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Let me suggest a small modification that highlights one of the things that
has me scratching my head a bit.

* Marso syntax.

DATA LIST /date (ADATE).
BEGIN DATA
10/12/2001
12/20/2002
.
.
END DATA.
LIST.
IF $CASENUM=3 date=-999.
IF $CASENUM=4 date=-995.
LIST.
VALUE LABELS date -999 '-999' -995 '-995'.
MISSING VALUES date (-999,-995).
FREQUENCIES ALL.
*********************************.
* NEXT LINE ADDED TO DM's SYNTAX.
*********************************.
COMPUTE x = date.
FORMATS date x (F12). /* Format x as F12 too.
LIST.

Output from the final LIST:

       date            x

13222224000  13222224000
13259721600  13259721600
       -999            .
       -995            .

Number of cases read:  4    Number of cases listed:  4

So even though the -999 and -995 are there in the date variable, they are
not there in x.  Why not?





David Marso wrote
> Run and study the following!
> DATA LIST /date (ADATE).
> BEGIN DATA
> 10/12/2001
> 12/20/2002
> .
> .
> END DATA.
> LIST.
> IF $CASENUM=3 date=-999.
> IF $CASENUM=4 date=-995.
> LIST.
> VALUE LABELS date -999 '-999' -995 '-995'.
> MISSING VALUES date (-999,-995).
> FREQUENCIES ALL.
> FORMATS date (F12).
> LIST.
>
>
>
> Elizabeth Tighe wrote
>> all spss .sav files.  And no problem re: setting them all to some
>> general missing value, I can do that.  But, I'd prefer being able to
>> maintain the specific missing values if possible.  Since it appears the
>> program recognizes them as specific missing and they display in the
>> frequencies as specific missing, it seems a matter of figuring out how
>> those specific missing are represented numerically in the data maybe?
>>
>> Thanks,
>> Liz Tighe
>>
>>
>> On 6/4/2014 3:42 PM, Bruce Weaver wrote:
>>> What is the source of the data--e.g., are you importing from Excel or
>>> some
>>> other type of non-SPSS file?  If so, you could import the date
>>> variable(s)
>>> in question as STRING variables initially, do whatever recoding you want
>>> to
>>> do, then convert the variable(s) to a date format via ALTER TYPE.
>>>
>>> If the data are already in an SPSS data file and the date variables
>>> formatted as date variables, you'll have the system missing value
>>> (SYSMIS)
>>> where things are missing.  In that case, you can still recode all of the
>>> missing values to some proper date value of your choosing; but you'll
>>> not be
>>> able to distinguish between different reasons for the missing data
>>> (i.e.,
>>> your -999 and -995 codes).
>>>
>>> Here's a small example.
>>>
>>> * Read in some sample data.
>>> NEW FILE.
>>> DATASET CLOSE all.
>>> DATA LIST list / DateVar(adate10).
>>> BEGIN DATA
>>> 6/4/2014
>>> 12/25/2013
>>> .
>>> END DATA.
>>>
>>> IF SYSMIS(DateVar) DateVar = date.dmy(1,1,1800).
>>> MISSING VALUES DateVar ("1/1/1800").
>>> VALUE LABELS DateVar "1/1/1800" "Missing".
>>> FREQUENCIES DateVar.
>>>
>>>
>>> Note the enclosure of the missing date value in quotes on the MISSING
>>> VALUES
>>> and VALUE LABELS lines.  The following is from the FM entry for MISSING
>>> VALUES:
>>>
>>> * For date format variables (for example, DATE, ADATE), missing values
>>> expressed in date formats must be enclosed in single or double quotes,
>>> and
>>> values must be expressed in the same date format as the defined date
>>> format
>>> for the variable.
>>>
>>> HTH.
>>>
>>>
>>>
>>> Elizabeth Tighe wrote
>>>> we have a date variable formatted as (ADATE10)
>>>>
>>>> some used our traditional specific missing values when the date was
>>>> missing, such as -999 or -995.
>>>>
>>>> These specific missing values have value labels, such as Missing:
>>>> Unspecified or Missing: Not Applicable
>>>>
>>>> The frequencies for the date variable recognizes these values as
>>>> specific missing.  However, the values of -999 and -995 are lost. The
>>>> values appear in frequency tables as ".Missing: Unspecified"
>>>>
>>>> Is there a way to recode these specific missing variables back into a
>>>> specific missing date variable, such as
>>>>
>>>> IF (date EQ .Missing:Not Applicable) date=date.mdy(01/01/1800).
>>>>
>>>> MISSING VALUES date ("01/01/1800").
>>>>
>>>> I cannot figure out how to recode these ".Missing: Label" values.
>>>>
>>>> Any tips/tricks would be much appreciated!
>>>>
>>>> =====================
>>>> To manage your subscription to SPSSX-L, send a message to
>>>> LISTSERV@.UGA
>>>>   (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
>>>
>>>
>>>
>>>
>>> -----
>>> --
>>> Bruce Weaver
>>>

>> bweaver@

>>>
http://sites.google.com/a/lakeheadu.ca/bweaver/
>>>
>>> "When all else fails, RTFM."
>>>
>>> NOTE: My Hotmail account is not monitored regularly.
>>> To send me an e-mail, please use the address shown above.
>>>
>>> --
>>> View this message in context:
>>>
http://spssx-discussion.1045642.n5.nabble.com/problem-with-missing-data-in-date-variables-tp5726334p5726337.html
>>> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>>
>>> =====================
>>> To manage your subscription to SPSSX-L, send a message to
>>>

>> LISTSERV@.UGA

>>  (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
>>
>> --
>>
>> Elizabeth Tighe, Ph.D.
>> Research Scientist
>> Steinhardt Social Research Institute
>> Brandeis University
>> 781.736.3824
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to

>> LISTSERV@.UGA

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





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/problem-with-missing-data-in-date-variables-tp5726334p5726348.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