syntax for weeks

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

syntax for weeks

Barkat Ullah
Hello, does anyine has a syntax that codes 20009 dates into 2009 weeks

week 1 end Jan 9
week 2 end Jan 16
week 3 end jan 23
..........
..........
week 22 end jun 25

Thank you for your assistance

=====================
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: syntax for weeks

Albert-Jan Roskam
Hi,
 
Assuming that your date variable is in spss date format:
 
compute weekno = xdate.week(date_variable).

Cheers!!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the face of ambiguity, refuse the temptation to guess.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

--- On Mon, 12/14/09, Barkat ullah <[hidden email]> wrote:

From: Barkat ullah <[hidden email]>
Subject: [SPSSX-L] syntax for weeks
To: [hidden email]
Date: Monday, December 14, 2009, 3:18 PM

Hello, does anyine has a syntax that codes 20009 dates into 2009 weeks

week 1 end Jan 9
week 2 end Jan 16
week 3 end jan 23
..........
..........
week 22 end jun 25

Thank you for your assistance

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@... (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: syntax for weeks

ViAnn Beadle
In reply to this post by Barkat Ullah
What's the format of the input variable? Do you want the output value to
look exactly like what you show below?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Barkat ullah
Sent: Monday, December 14, 2009 7:18 AM
To: [hidden email]
Subject: syntax for weeks

Hello, does anyine has a syntax that codes 20009 dates into 2009 weeks

week 1 end Jan 9
week 2 end Jan 16
week 3 end jan 23
..........
..........
week 22 end jun 25

Thank you for your assistance

=====================
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: syntax for weeks

Maguin, Eugene
In reply to this post by Barkat Ullah
Barkat,

Look at and test this function. I've used it before but several years ago
and I think it counts weeks based on the weekend so that in 2009 week 1
would be that partial week from Jan 1 to Jan 3 or 4, depending on where the
'week' is considered to end.


XDATE.WEEK. XDATE.WEEK(datevalue). Numeric. Returns the week number (an
integer
between 1 and 53) from a numeric value that represents a date. The argument
can be a number, a date format variable, or an expression that resolves to a
date.

Gene Maguin

=====================
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: syntax for weeks

Barkat Ullah
In reply to this post by Barkat Ullah
On Mon, 14 Dec 2009 07:23:18 -0800, Albert-Jan Roskam <[hidden email]>
wrote:

>Hi,
>?
>Assuming that your date variable is in spss date format:
>?
>compute weekno = xdate.week(date_variable).
>
>Cheers!!
>Albert-Jan
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>In the face of ambiguity, refuse the temptation to guess.
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>--- On Mon, 12/14/09, Barkat ullah <[hidden email]> wrote:
>
>
>From: Barkat ullah <[hidden email]>
>Subject: [SPSSX-L] syntax for weeks
>To: [hidden email]
>Date: Monday, December 14, 2009, 3:18 PM
>
>
>Hello, does anyine has a syntax that codes 20009 dates into 2009 weeks
>
>week 1 end Jan 9
>week 2 end Jan 16
>week 3 end jan 23
>..........
>..........
>week 22 end jun 25
>
>Thank you for your assistance
>
>=====================
>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
>

Thank you so much for your help!

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