selecting dates

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

selecting dates

Muir Houston-2
I have a variable DoB in date format dd.mm.yy
what I want to do is select those cases who were born in the months June, July and August - so what I want is those whose DoB is either dd.06.yy, dd.07.yy, or dd.08.yy
 
I am not sure if I can just use a select if or if it requires specific syntax?
I was thinking of splitting DoB into its component parts, and then just selecting if Month = 6, 7, 8
 
 
thanks in advance
 
 
Muir
 
 
Reply | Threaded
Open this post in threaded view
|

Re: selecting dates

Oliver, Richard

select if xdate.month(dob)>=6 and xdate.month(dob)<=8.

 


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Muir Houston
Sent: Wednesday, April 15, 2009 8:59 AM
To: [hidden email]
Subject: selecting dates

 

I have a variable DoB in date format dd.mm.yy

what I want to do is select those cases who were born in the months June, July and August - so what I want is those whose DoB is either dd.06.yy, dd.07.yy, or dd.08.yy

 

I am not sure if I can just use a select if or if it requires specific syntax?

I was thinking of splitting DoB into its component parts, and then just selecting if Month = 6, 7, 8

 

 

thanks in advance

 

 

Muir

 

 

Reply | Threaded
Open this post in threaded view
|

Re: selecting dates

ViAnn Beadle
In reply to this post by Muir Houston-2

Use xdate.month to get the month value and check that against these months—something like this should work.

 

Compute filtervar = any(xdate.month(yourdatevariable),6,7,8).

Filter by filtervar.

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Muir Houston
Sent: Wednesday, April 15, 2009 7:59 AM
To: [hidden email]
Subject: selecting dates

 

I have a variable DoB in date format dd.mm.yy

what I want to do is select those cases who were born in the months June, July and August - so what I want is those whose DoB is either dd.06.yy, dd.07.yy, or dd.08.yy

 

I am not sure if I can just use a select if or if it requires specific syntax?

I was thinking of splitting DoB into its component parts, and then just selecting if Month = 6, 7, 8

 

 

thanks in advance

 

 

Muir