error message

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

error message

DeMichele, Matthew
I am running a large input file that includes date recodes and
frequencies. Everything enters and runs, with the exception of a
frequency command at the end of the syntax for four variables.

I receive the following error message:

"One of the arguments to the DATE function is out of range or is not an
integer. The result has been set to the system-missing value."

My confusion stems from the variables are not date variables but rather
numeric four digit years, and the frequencies command runs if I
highlight and select that command to run after the setup file.

I imagine there might be a typo or something on my part, but I've yet to
figure it out and hoped someone on the listserve might have some ideas.

Thank you in advance for any assistance.

Best,

Matthew

=====================
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: error message

Ives, Melissa L
It is not the variable that is in question, per this error  message, but what is being done with the variable using a date function -- i.e. are you using DATE.MDY() or XDATE??
When you run frequencies, are there any blanks that are spaces?
Melissa

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of DeMichele, Matthew
Sent: Wednesday, January 15, 2014 9:14 AM
To: [hidden email]
Subject: [SPSSX-L] error message

I am running a large input file that includes date recodes and frequencies. Everything enters and runs, with the exception of a frequency command at the end of the syntax for four variables.

I receive the following error message:

"One of the arguments to the DATE function is out of range or is not an integer. The result has been set to the system-missing value."

My confusion stems from the variables are not date variables but rather numeric four digit years, and the frequencies command runs if I highlight and select that command to run after the setup file.

I imagine there might be a typo or something on my part, but I've yet to figure it out and hoped someone on the listserve might have some ideas.

Thank you in advance for any assistance.

Best,

Matthew

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

This correspondence contains proprietary information some or all of which may be legally privileged; it is for the intended recipient only. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this correspondence and completely dispose of the correspondence immediately.  Please notify the sender if you have received this email in error.  NOTE: Messages to or from the State of Connecticut domain may be subject to the Freedom of Information statutes and regulations.

=====================
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: error message

Bruce Weaver
Administrator
In reply to this post by DeMichele, Matthew
I'll take "running a large input file" to mean running a syntax file that imports some data and then does some data management including recoding and computing new variables.  

I imagine the DATE function referred to in that error message is something like a DATE.DMY(d,m,y) function in a COMPUTE statement.  If so, one of the arguments is not within the required range (e.g., a month value outside the range 1-12).  What's the source of the original data?  Was it entered by hand?  Perhaps there are data entry errors that need to be flagged and corrected in the original file?  (Or perhaps the D and M variables are the wrong way around?)  

HTH.


DeMichele, Matthew wrote
I am running a large input file that includes date recodes and
frequencies. Everything enters and runs, with the exception of a
frequency command at the end of the syntax for four variables.

I receive the following error message:

"One of the arguments to the DATE function is out of range or is not an
integer. The result has been set to the system-missing value."

My confusion stems from the variables are not date variables but rather
numeric four digit years, and the frequencies command runs if I
highlight and select that command to run after the setup file.

I imagine there might be a typo or something on my part, but I've yet to
figure it out and hoped someone on the listserve might have some ideas.

Thank you in advance for any assistance.

Best,

Matthew

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

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
Reply | Threaded
Open this post in threaded view
|

Re: error message

Robert Jones
In reply to this post by DeMichele, Matthew
It's always helpful to post the relevant syntax and the minimum of the data necessary to illustrate the problem, so that others can help more easily.

Some guidelines on posting can be found at http://www.catb.org/~esr/faqs/smart-questions.html - there are several more to be found by searching.  Most forums have their own guidelines.
Reply | Threaded
Open this post in threaded view
|

error message

DeMichele, Matthew
In reply to this post by DeMichele, Matthew
Hi SPSS list:
Forgive me for asking such basic questions, but I'm somewhat new to SPSS
programming (a bit more comfortable with Stata). Once again, I have a
question about an 8 digit string variable that contains dates arranged
as yyyymmdd. I need to break this into separate variables for each of
the date elements and combine these elements into a single date
variable. In some ways I've been able to accomplish this goal using both
codes providing below. However, I receive error messages.

IF _DATE ~=MISSING.
   COMPUTE v13 = number(substr(_DATE,7,2),f2).
   COMPUTE v14= number(substr(_DATE,5,2),f2).
   COMPUTE v15 = number(substr(_DATE,1,4),f4).
   COMPUTE _DATE1 = date.dmy(v13,v14,v15).
   FORMATS _DATE1(date10).
(error message here suggests an incorrect name or more than 64
characters for the "if" command line).


DO IF (_DATE ~=MISSING).
   COMPUTE v44= number(char.substr(_DATE,7,2),f2).
   COMPUTE v45= number(char.substr(_DATE,5,2),f2).
   COMPUTE v46 = number(char.substr(_DATE,1,4),f4).
   COMPUTE _DATE1 = date.dmy(v44,v45,v46).
   FORMATS _DATE1(date10).
   end if.
(error message here is the same as above for the "do if" line, and
another one for the "end if" line referencing a level of control).

Again, each code works to transform the data, but I need to get rid of
the error messages.

Any suggestions on a fix for this problem?

Thank you,

Matthew

=====================
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: error message

Richard Ristow
At 02:20 PM 1/16/2014, DeMichele, Matthew wrote:

>DO IF (_DATE ~=MISSING).
>    COMPUTE v44= number(char.substr(_DATE,7,2),f2).
>    COMPUTE v45= number(char.substr(_DATE,5,2),f2).
>    COMPUTE v46 = number(char.substr(_DATE,1,4),f4).
>    COMPUTE _DATE1 = date.dmy(v44,v45,v46).
>    FORMATS _DATE1(date10).
>    end if.
>(error message here suggests an incorrect name or more than 64
>characters for the "do if" command line,  and another one for the
>"end if" line referencing a level of control).

Your problem is that you're doing the test the wrong way. SPSS is
treating "MISSING" as a regular variable, and giving you the error
message because there is no such variable. (The error for the "end
if." has to do with the somewhat unfortunate way that SPSS handles
statement errors: the effect is as if the statement with the error
didn't exist.)

In SPSS, the test you want is written

DO IF (NOT MISSING(_DATE)).

-- that is, "MISSING" is a function, not a value. (Are you maybe used
to SAS? In SAS, the test is written much more as you've tried it.)

-Best of luck,
  Richard

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