creating a new date by comparing other dates

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

creating a new date by comparing other dates

Raffe, Sydelle, SSA
I am creating a new date variable called dispdate by detecting whether or not they have an apprdate or a denldate (or both). If both, I want the earlier date; if only denldate, I want that; and if only apprdate, I want that to end up in dispdate. Here's my syntax.

do if ((not(missing(apprdate)) and not(missing(denldate)) and (date.mdy(apprdate)) lt (date.mdy(denldate)))).
     compute dispdate = apprdate.
   else if ((not(missing(apprdate)) and not(missing(denldate)) and (date.mdy(apprdate)) ge (date.mdy(denldate)))).
     compute dispdate = denldate.
   else if ((missing(apprdate)) and (missing(denldate))).
     compute dispdate = (date.mdy(04,30,2007)).  
end if.
exe.

And here's the initial error response.

>Error # 4327 in column 81.  Text: )
>The number of arguments required for the specified subfunction does not
>match the number of arguments supplied.  Check for a comma used as a
>decimal delimiter.  Commas cannot be used as decimal delimiters in
>transformations.
>This command not executed.

I appreciate your help as always.

Sydelle Raffe, Alameda County Social Services Agency
Information Services Division
e:mail:  [hidden email]
phone: 510-271-9174     fax: 510-271-9107
If you have a request for information, please submit an ODM request form at:  https://alamedasocialservices.org/staff/support_services/statistics_and_reports/odm/index.cfm
Reply | Threaded
Open this post in threaded view
|

Re: creating a new date by comparing other dates

Maguin, Eugene
Sydelle,

Look at the construction of date.mdy in the syntax reference. I belive
you'll find that date.mdy expects a construction like date.mdy(4,10,2007).
Something like date.mdy(sd345) won't work. Instead just compare the date
vars directly as in

do if (not(missing(apprdate)) and not(missing(denldate)) and (apprdate lt
denldate)).

Gene Maguin
Reply | Threaded
Open this post in threaded view
|

Re: creating a new date by comparing other dates

Raffe, Sydelle, SSA
That was my original take on it but while there was no error response, it didn't create the new variable. Just tried that again and no error, but no value for the new variable. It comes up as system missing. Thanks.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]]On Behalf Of
Gene Maguin
Sent: Tuesday, May 22, 2007 11:09 AM
To: [hidden email]
Subject: Re: creating a new date by comparing other dates


Sydelle,

Look at the construction of date.mdy in the syntax reference. I belive
you'll find that date.mdy expects a construction like date.mdy(4,10,2007).
Something like date.mdy(sd345) won't work. Instead just compare the date
vars directly as in

do if (not(missing(apprdate)) and not(missing(denldate)) and (apprdate lt
denldate)).

Gene Maguin
Reply | Threaded
Open this post in threaded view
|

Re: creating a new date by comparing other dates

Richard Ristow
In reply to this post by Raffe, Sydelle, SSA
At 01:51 PM 5/22/2007, Raffe, Sydelle, SSA wrote:

>I am creating a new date variable called dispdate by detecting whether
>or not they have an apprdate or a denldate (or both). If both, I want
>the earlier date; if only denldate, I want that; and if only apprdate,
>I want that to end up in dispdate.

Gene's right, of course: date.mdy(<existing date variable>) is both
invalid and meaningless.

For your problem, why not (not tested)

NUMERIC dispdate (ADATE10) /* so it's formatted correctly */.
COMPUTE dispdate = MIN(apprdate,denldate).
IF MISSING (dispdate)
         dispdate = date.mdy(04,30,2007).





>Here's my syntax.
>
>do if ((not(missing(apprdate)) and not(missing(denldate)) and
>(date.mdy(apprdate)) lt (date.mdy(denldate)))).
>      compute dispdate = apprdate.
>    else if ((not(missing(apprdate)) and not(missing(denldate)) and
> (date.mdy(apprdate)) ge (date.mdy(denldate)))).
>      compute dispdate = denldate.
>    else if ((missing(apprdate)) and (missing(denldate))).
>      compute dispdate = (date.mdy(04,30,2007)).
>end if.
>exe.
>
>And here's the initial error response.
>
> >Error # 4327 in column 81.  Text: )
> >The number of arguments required for the specified subfunction does
> not
> >match the number of arguments supplied.  Check for a comma used as a
> >decimal delimiter.  Commas cannot be used as decimal delimiters in
> >transformations.
> >This command not executed.
>
>I appreciate your help as always.
>
>Sydelle Raffe, Alameda County Social Services Agency
>Information Services Division
>e:mail:  [hidden email]
>phone: 510-271-9174     fax: 510-271-9107
>If you have a request for information, please submit an ODM request
>form
>at:
>https://alamedasocialservices.org/staff/support_services/statistics_and_reports/odm/index.cfm
>
>
>
>--
>No virus found in this incoming message.
>Checked by AVG Free Edition.
>Version: 7.5.467 / Virus Database: 269.7.6/815 - Release Date:
>5/22/2007 3:49 PM