Missing values for dates A surprise to me.

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

Missing values for dates A surprise to me.

Art Kendall
I am using this in SPSS 27.  Does this work in other versions?

I thought it was not possible to set missing values for dates or add value labels for dates.

I was able to enter value labels and missing data specifications in the variables view.
Using a range makes it possible to have more labelled kind of missing data.

I was able to do it in syntax.

New file.
data list list /MyDate (adate10).
Begin data.
12/25/2021
7/4/2021
5/5/2000
12/25/2021
7/4/2021
5/5/2000
12/25/2021
7/4/2021
5/5/2000
10/15/1582
10/16/1582
12/25/2021
7/4/2021
5/5/2000
10/15/1582
10/16/1582
10/17/1582
12/25/2021
7/4/2021
5/5/2000
10/15/1582
10/16/1582
10/10/1800
end data.
display dictionary.
missing values MyDate ('10/15/1582' THRU '10/20/1582', '10/10/1800').
Value labels MyDate
'10/15/1582' 'unknown'
'10/16/1582' 'refused to answer'
'10/10/1800' 'forgot to ask'.
display dictionary.
frequencies MyDate.
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Missing values for dates A surprise to me.

Art Kendall
My version 27 of SPSS was on Windows 10.

The syntax worked in SPSS 24 on Windows 10.

Has anybody else tried the syntax I posted?

Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Missing values for dates A surprise to me.

Bruce Weaver
Administrator
Hi Art.  It works for me using SPSS 26.0.0.1 (Windows 10).  I'm not surprised, given that date variables are really numeric variables.  And the Overview for MISSING VALUES in the CSR does include this bullet point:

* 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.

https://www.ibm.com/docs/en/spss-statistics/26.0.0?topic=values-overview-missing-command

I assume you saw that, given the use of quotes in your code.  


Art Kendall wrote
My version 27 of SPSS was on Windows 10.

The syntax worked in SPSS 24 on Windows 10.

Has anybody else tried the syntax I posted?
--
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: Missing values for dates A surprise to me.

Art Kendall
<head slap>  I should go back and read the whole CSR every 5 years or so.
Usually, I only look at the new parts.

As you know, I like to label reasons for data being missing.  I like the ability to label a range of date values as missing.

The use of quotes was a guess. I knew that I did not want the slash to be read as a division operator.
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Missing values for dates A surprise to me.

Bruce Weaver
Administrator
Good guess!  ;-)  

Art Kendall wrote
The use of quotes was a guess. I knew that I did not want the slash to be read as a division operator.
--
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/).