Date extraction

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

Date extraction

Samir Omerovic
Dear list,

 

I have following problem. I have several date variables, well actually
string variables which I will transform into dates, in SPSS. I have dates of
all household members and I have date of the time when interview has been
conducted. I need to find out the person in that household who last had its
birthday just to see if we asked the right respondent. What commands should
I use, or does anybody has some syntax I can use?

 

Regards to all

 

Samir

 

Samir Omerovic
Researcher
___________________________
GfK BH d.o.o.
Skenderija 44
71 000 Sarajevo
Bosnia and Herzegovina
Phone +387 33 550 300
Fax +387 33 444 226
[hidden email]
www.gfk.ba
Before printing this e-mail, please consider environment protection.

This e-mail (and any attachment/s) contains confidential and/or privileged
information. If you are not the intended recipient (or have
received this e-mail in error) please notify the sender immediately and
destroy this e-mail.  Any unauthorized copying, disclosure or
 distribution of the material in this e-mail is strictly forbidden.

Ova e-poruka sadrži povjerljive i/ili povlaštene podatke. Ako niste osoba
naznačena kao primalac molimo odmah upozoriti pošiljaoca
i uništiti primljenu e-poruku. Neautorizirano kopiranje, objavljivanje ili
distribucija sadržaja iz elektronske poruke striktno je zabranjeno.

  _____  

 

 

====================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: Date extraction

ViAnn Beadle
See if the Date and Time Wizard will paste the right syntax for your
situation.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Samir Omerovic
Sent: Tuesday, March 18, 2008 7:12 AM
To: [hidden email]
Subject: Date extraction

Dear list,



I have following problem. I have several date variables, well actually
string variables which I will transform into dates, in SPSS. I have dates of
all household members and I have date of the time when interview has been
conducted. I need to find out the person in that household who last had its
birthday just to see if we asked the right respondent. What commands should
I use, or does anybody has some syntax I can use?



Regards to all



Samir



Samir Omerovic
Researcher
___________________________
GfK BH d.o.o.
Skenderija 44
71 000 Sarajevo
Bosnia and Herzegovina
Phone +387 33 550 300
Fax +387 33 444 226
[hidden email]
www.gfk.ba
Before printing this e-mail, please consider environment protection.

This e-mail (and any attachment/s) contains confidential and/or privileged
information. If you are not the intended recipient (or have
received this e-mail in error) please notify the sender immediately and
destroy this e-mail.  Any unauthorized copying, disclosure or
 distribution of the material in this e-mail is strictly forbidden.

Ova e-poruka sadrži povjerljive i/ili povlaštene podatke. Ako niste osoba
naznačena kao primalac molimo odmah upozoriti pošiljaoca
i uništiti primljenu e-poruku. Neautorizirano kopiranje, objavljivanje ili
distribucija sadržaja iz elektronske poruke striktno je zabranjeno.

  _____





=======
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Date extraction

Richard Ristow
In reply to this post by Samir Omerovic
At 09:11 AM 3/18/2008, Samir Omerovic wrote:

>I have several date variables. I have dates of all household members
>and I have date of the time when interview has been conducted. I
>need to find out the person in that household who last had its birthday.

Here's quick logic. If two household members have the same, latest
birth date, it will find the first. For illustration, I'm assuming
you allow up to 5 household members; that each has variables BDateN
(date) and NameN (A20), and you want the name and birth date of the
one with the latest birth date; and that the names and birth dates
are not necessarily contiguous separately.

Not tested:

STRING  LtstName (A20)
NUMERIC LtstBDte (DATE11).

VAR LABEL
         LtstName 'Name of latest-born household member'
         LtstBDte 'Birth date of latest-born member'.

COMPUTE LtstBDte = MAX(BDate1, BDate2, BDate3, BDate4, BDate5).
COMPUTE LtstName = ''.

DO REPEAT Name  = Name1  Name2  Name3  Name4  Name5
          /BDate = BDate1 BDate2 BDate3 BDate4 BDate5.
.  IF   BDate    EQ LtstBDte
     AND LtstName EQ ' '
         LtstName  = Name.
END REPEAT.

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