Compute season from available dates

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

Compute season from available dates

spssdummy
Hey,
I would like to add the variable season to my data set, consisting of winter
(december-february), spring (march-may), summer (june-august), and autumn
(september-november). I want to do this by using the dates that are
available in my dataset, which are formatted as day.month.year (e.g.
01.01.2010). I have tried compute variable and recode into different
variables, but nothing has worked so far.

Thank you for helping out x



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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: Compute season from available dates

Kevin longfield
Hello,

if your field is a already a true date and not a string then you can use the Range function:

***** Range is Inclusive so need to add an extra day to the end of the season to Include May 31

If Range(YourDateField,DATE.MDY(3,1,2018),DATE.MDY(6,1,2018)) Season = 'Spring'.

Kevin.

On Tue, May 7, 2019 at 11:59 AM spssdummy <[hidden email]> wrote:
Hey,
I would like to add the variable season to my data set, consisting of winter
(december-february), spring (march-may), summer (june-august), and autumn
(september-november). I want to do this by using the dates that are
available in my dataset, which are formatted as day.month.year (e.g.
01.01.2010). I have tried compute variable and recode into different
variables, but nothing has worked so far.

Thank you for helping out x



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

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


--
Kevin Longfield
(586) 419 - 5838
Vice President - Data Operations
www.phoenixmi.com
CONFIDENTIALITY NOTICE: This email message and any attachments are for the sole use of the intended recipient(s) and may contain proprietary, confidential, trade secret or privileged information. Any unauthorized review, use, disclosure or distribution is prohibited and may be a violation of law. If you are not the intended recipient or a person responsible for delivering this message to an intended recipient, please contact the sender by reply email and destroy all copies of the original message.  

--
This electronic message, including its attachments (if any), is CONFIDENTIAL and may contain PROPRIETARY or LEGALLY PRIVILEGED information. If you are not the intended recipient, you are hereby notified that any use, disclosure, copying, or distribution of this message, its attachments, or any of the information included therein, is unauthorized and strictly prohibited. If you have received this message in error, please immediately notify the sender by reply e-mail and permanently delete this message and its attachments, along with any copies thereof.

===================== 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: Compute season from available dates

spssdummy
Thanks for replying.
Unfortunately, when trying range, I still get this notification: Incorrect
variable name: either the name is more than 64 characters, or it is not
defined by a previous command.​

I don't know why and how to solve it..



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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: Compute season from available dates

John F Hall
I've been having similar problems recently.  I solved by copying varname directly from Data Editor, but then discovered that Arial shows I when Calibri shows i.  Changing l to I solved the problem.

John F Hall  MA (Cantab) Dip Ed (Dunelm)
[Retired academic survey researcher]

Email:          [hidden email]
Website:     Journeys in Survey Research
Course:       Survey Analysis Workshop (SPSS)
Research:   Subjective Social Indicators (Quality of Life)

-----Original Message-----
From: SPSSX(r) Discussion <[hidden email]> On Behalf Of spssdummy
Sent: 07 May 2019 19:11
To: [hidden email]
Subject: Re: Compute season from available dates

Thanks for replying.
Unfortunately, when trying range, I still get this notification: Incorrect variable name: either the name is more than 64 characters, or it is not defined by a previous command.​

I don't know why and how to solve it..



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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: Compute season from available dates

spssdummy
Thanks, but how do you change it to I?



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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: Compute season from available dates

bdates

Use Kevin's syntax preceded by assigning Season as a string variable. Syntax is tested.


String season(a10) .

if Range(YourDateField,DATE.MDY(3,1,2018),DATE.MDY(6,1,2018)) Season = 'Spring' .

execute .


Brian

From: SPSSX(r) Discussion <[hidden email]> on behalf of spssdummy <[hidden email]>
Sent: Tuesday, May 7, 2019 1:41:32 PM
To: [hidden email]
Subject: Re: Compute season from available dates
 
Thanks, but how do you change it to I?



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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: Compute season from available dates

Rick Oliver
Yup. New string variables need to be declared first. Another solution would be to make the new variable numeric (1, 2, 3, 4) and assign value labels (1='Spring'). Numeric values tend to be easier to work with.

On Tue, May 7, 2019, 12:45 PM Dates, Brian <[hidden email]> wrote:

Use Kevin's syntax preceded by assigning Season as a string variable. Syntax is tested.


String season(a10) .

if Range(YourDateField,DATE.MDY(3,1,2018),DATE.MDY(6,1,2018)) Season = 'Spring' .

execute .


Brian

From: SPSSX(r) Discussion <[hidden email]> on behalf of spssdummy <[hidden email]>
Sent: Tuesday, May 7, 2019 1:41:32 PM
To: [hidden email]
Subject: Re: Compute season from available dates
 
Thanks, but how do you change it to I?



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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
===================== 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: Compute season from available dates

spssdummy
Thanks,
Unfortunately still the same notification: I still get this notification:
Incorrect variable name: either the name is more than 64 characters, or it
is not defined by a previous command.​



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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: Compute season from available dates

bdates

Here's the full syntax suggested by Rick. A little clutchy, but it works.


if Range(YourDateField,DATE.MDY(3,1,2011),DATE.MDY(6,1,2011)) Season = 1.
if Range(YourDateField,DATE.MDY(6,1,2011),DATE.MDY(9,1,2011)) Season = 2.
if Range(YourDateField,DATE.MDY(9,1,2011),DATE.MDY(12,1,2011)) Season = 3.
if Range(YourDateField,DATE.MDY(12,1,2011),DATE.MDY(3,1,2012)) Season = 4.
execute .
add value labels season 1 'Spring' 2 'Summer'  3 'Autumn'  4 'Winter' .

However...Kevin's original post was based on the date field being a true date and not a string. Other than this, I think we'd have to see your data. Maybe you could check first as the data type for the date field, and then send us a few lines of the date field.


Brian 

From: SPSSX(r) Discussion <[hidden email]> on behalf of spssdummy <[hidden email]>
Sent: Tuesday, May 7, 2019 1:58:21 PM
To: [hidden email]
Subject: Re: Compute season from available dates
 
Thanks,
Unfortunately still the same notification: I still get this notification:
Incorrect variable name: either the name is more than 64 characters, or it
is not defined by a previous command.​



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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: Compute season from available dates

David Marso
Administrator
In reply to this post by spssdummy
Please post your syntax and the exact error message!



spssdummy wrote

> Thanks,
> Unfortunately still the same notification: I still get this notification:
> Incorrect variable name: either the name is more than 64 characters, or it
> is not defined by a previous command.​
>
>
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

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





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Compute season from available dates

David Marso
Administrator
In reply to this post by Kevin longfield
It would be much more efficient to use the XDATE.MONTH function and recode
the result?


Kevin longfield wrote

> Hello,
>
> if your field is a already a true date and not a string then you can use
> the Range function:
>
> ***** Range is Inclusive so need to add an extra day to the end of the
> season to Include May 31
>
> If Range(YourDateField,DATE.MDY(3,1,2018),DATE.MDY(6,1,2018)) Season =
> 'Spring'.
>
> Kevin.
>
> On Tue, May 7, 2019 at 11:59 AM spssdummy &lt;

> mischa.lenaers@

> &gt; wrote:
>
>> Hey,
>> I would like to add the variable season to my data set, consisting of
>> winter
>> (december-february), spring (march-may), summer (june-august), and autumn
>> (september-november). I want to do this by using the dates that are
>> available in my dataset, which are formatted as day.month.year (e.g.
>> 01.01.2010). I have tried compute variable and recode into different
>> variables, but nothing has worked so far.
>>
>> Thank you for helping out x
>>
>>
>>
>> --
>> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>>

> LISTSERV@.UGA

>  (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
>>
>
>
> --
> *Kevin Longfield*
> (586) 419 - 5838
> Vice President - Data Operations
> www.phoenixmi.com
> CONFIDENTIALITY NOTICE: This email message and any attachments are for the
> sole use of the intended recipient(s) and may contain proprietary,
> confidential, trade secret or privileged information. Any unauthorized
> review, use, disclosure or distribution is prohibited and may be a
> violation of law. If you are not the intended recipient or a person
> responsible for delivering this message to an intended recipient, please
> contact the sender by reply email and destroy all copies of the original
> message.
>
> --
> --
> This electronic message, including its attachments (if any), is
> CONFIDENTIAL and may contain PROPRIETARY or LEGALLY PRIVILEGED
> information.
> If you are not the intended recipient, you are hereby notified that any
> use, disclosure, copying, or distribution of this message, its
> attachments,
> or any of the information included therein, is unauthorized and strictly
> prohibited. If you have received this message in error, please immediately
> notify the sender by reply e-mail and permanently delete this message and
> its attachments, along with any copies thereof.
>
>
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

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





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Compute season from available dates

spssdummy
In reply to this post by David Marso
Syntax (one part):

if Range(VISIT1_DATE,DATE.DMY(01,09,2010),DATE.MDY(30,11,2010)) Season = 1.


Error:

Incorrect variable name: either the name is more than 64 characters, or it
is not defined by a previous command.



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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: Compute season from available dates

bdates

The formula that Kevin sent presumes that the dates are in the same format, dmy or mdy. At least the second part of your formula, date.mdy(30,11,2010) is dmy. There aren't 30 months. Do you need to change the second factor to date.dmy?


Brian

From: SPSSX(r) Discussion <[hidden email]> on behalf of spssdummy <[hidden email]>
Sent: Tuesday, May 7, 2019 3:03:50 PM
To: [hidden email]
Subject: Re: Compute season from available dates
 
Syntax (one part):

if Range(VISIT1_DATE,DATE.DMY(01,09,2010),DATE.MDY(30,11,2010)) Season = 1.


Error:

Incorrect variable name: either the name is more than 64 characters, or it
is not defined by a previous command.



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/



=====================
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: Compute season from available dates

David Marso
Administrator
IMNSHO RANGE is a very inelegant solution here.
See XDATE.MONTH.


bdates wrote
> The formula that Kevin sent presumes that the dates are in the same
> format, dmy or mdy. At least the second part of your formula,
> date.mdy(30,11,2010) is dmy. There aren't 30 months. Do you need to change
> the second factor to date.dmy?
>
>
> Brian
> ________________________________
> From: SPSSX(r) Discussion &lt;

> SPSSX-L@.UGA

> &gt; on behalf of spssdummy &lt;

> mischa.lenaers@

> &gt;
> Sent: Tuesday, May 7, 2019 3:03:50 PM
> To:

> SPSSX-L@.UGA

> Subject: Re: Compute season from available dates
>
> Syntax (one part):
>
> if Range(VISIT1_DATE,DATE.DMY(01,09,2010),DATE.MDY(30,11,2010)) Season =
> 1.
>
>
> Error:
>
> Incorrect variable name: either the name is more than 64 characters, or it
> is not defined by a previous command.
>
>
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
> SPSSX Discussion | Mailing List
> Archive&lt;http://spssx-discussion.1045642.n5.nabble.com/&gt;
> spssx-discussion.1045642.n5.nabble.com
> SPSSX Discussion forum and mailing list archive. This forum is an archive
> for the mailing list

> spssx-l@.uga

>  (more options) Messages posted here will be sent to this mailing list.
>
>
>
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

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

> LISTSERV@.UGA

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





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Compute season from available dates

bdates

Absolutely inelegant. Yours is far more straight forward. I got caught in the OP's syntax. Hope I didn't make your eyes bleed.


Brian

From: SPSSX(r) Discussion <[hidden email]> on behalf of David Marso <[hidden email]>
Sent: Tuesday, May 7, 2019 3:43:00 PM
To: [hidden email]
Subject: Re: Compute season from available dates
 
IMNSHO RANGE is a very inelegant solution here.
See XDATE.MONTH.


bdates wrote
> The formula that Kevin sent presumes that the dates are in the same
> format, dmy or mdy. At least the second part of your formula,
> date.mdy(30,11,2010) is dmy. There aren't 30 months. Do you need to change
> the second factor to date.dmy?
>
>
> Brian
> ________________________________
> From: SPSSX(r) Discussion &lt;

> SPSSX-L@.UGA

> &gt; on behalf of spssdummy &lt;

> mischa.lenaers@

> &gt;
> Sent: Tuesday, May 7, 2019 3:03:50 PM
> To:

> SPSSX-L@.UGA

> Subject: Re: Compute season from available dates
>
> Syntax (one part):
>
> if Range(VISIT1_DATE,DATE.DMY(01,09,2010),DATE.MDY(30,11,2010)) Season =
> 1.
>
>
> Error:
>
> Incorrect variable name: either the name is more than 64 characters, or it
> is not defined by a previous command.
>
>
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
> SPSSX Discussion | Mailing List
> Archive&lt;http://spssx-discussion.1045642.n5.nabble.com/&gt;
> spssx-discussion.1045642.n5.nabble.com
> SPSSX Discussion forum and mailing list archive. This forum is an archive
> for the mailing list

> spssx-l@.uga

>  (more options) Messages posted here will be sent to this mailing list.
>
>
>
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

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

> LISTSERV@.UGA

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





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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: Compute season from available dates

spssdummy
In reply to this post by bdates
That's indeed true. I now have 12 months (like january has no.1 and december
has no.12). Now I want to convert this into the seasons, so winter (12,1,2),
spring (3,4,5), summer (6,7,8) and autumn (9,10,11). Any suggestions?



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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: Compute season from available dates

bdates

Try this (tested).


compute season=XDATE.MONTH(yourdatevariable) .
RECODE Season (3 thru 5=1) (6 thru 8=2) (9 thru 11=3) (ELSE=4).
execute .
add value labels season 1 'Spring' 2 'Summer' 3 'Autumn' 4 'Winter' .


Brian

From: SPSSX(r) Discussion <[hidden email]> on behalf of spssdummy <[hidden email]>
Sent: Tuesday, May 7, 2019 3:53:43 PM
To: [hidden email]
Subject: Re: Compute season from available dates
 
That's indeed true. I now have 12 months (like january has no.1 and december
has no.12). Now I want to convert this into the seasons, so winter (12,1,2),
spring (3,4,5), summer (6,7,8) and autumn (9,10,11). Any suggestions?



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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: Compute season from available dates

David Marso
Administrator
In reply to this post by bdates
Teared up.
Need more tissue ;-).


bdates wrote
> Absolutely inelegant. Yours is far more straight forward. I got caught in
> the OP's syntax. Hope I didn't make your eyes bleed.
>
>
> Brian
> ________________________________
> From: SPSSX(r) Discussion &lt;

> SPSSX-L@.UGA

> &gt; on behalf of David Marso &lt;

> david.marso@

> &gt;
> Sent: Tuesday, May 7, 2019 3:43:00 PM
> To:

> SPSSX-L@.UGA

> Subject: Re: Compute season from available dates
>
> IMNSHO RANGE is a very inelegant solution here.
> See XDATE.MONTH.
>
>
> bdates wrote
>> The formula that Kevin sent presumes that the dates are in the same
>> format, dmy or mdy. At least the second part of your formula,
>> date.mdy(30,11,2010) is dmy. There aren't 30 months. Do you need to
>> change
>> the second factor to date.dmy?
>>
>>
>> Brian
>> ________________________________
>> From: SPSSX(r) Discussion &lt;
>
>> SPSSX-L@.UGA
>
>> &gt; on behalf of spssdummy &lt;
>
>> mischa.lenaers@
>
>> &gt;
>> Sent: Tuesday, May 7, 2019 3:03:50 PM
>> To:
>
>> SPSSX-L@.UGA
>
>> Subject: Re: Compute season from available dates
>>
>> Syntax (one part):
>>
>> if Range(VISIT1_DATE,DATE.DMY(01,09,2010),DATE.MDY(30,11,2010)) Season =
>> 1.
>>
>>
>> Error:
>>
>> Incorrect variable name: either the name is more than 64 characters, or
>> it
>> is not defined by a previous command.
>>
>>
>>
>> --
>> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>> SPSSX Discussion | Mailing List
>> Archive&lt;http://spssx-discussion.1045642.n5.nabble.com/&gt;
>> spssx-discussion.1045642.n5.nabble.com
>> SPSSX Discussion forum and mailing list archive. This forum is an archive
>> for the mailing list
>
>> spssx-l@.uga
>
>>  (more options) Messages posted here will be sent to this mailing list.
>>
>>
>>
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>
>> LISTSERV@.UGA
>
>>  (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
>
>> LISTSERV@.UGA
>
>>  (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
>
>
>
>
>
> -----
> Please reply to the list and not to my personal email.
> Those desiring my consulting or training services please feel free to
> email me.
> ---
> "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos
> ne forte conculcent eas pedibus suis."
> Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in
> abyssum?"
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

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

> LISTSERV@.UGA

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





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Compute season from available dates

spssdummy
In reply to this post by bdates
When I try this, first they all get 4 (as in winter) and at the second
attempt they all get 1, instead of 1,2,3, and 4 being assigned to the
seasons



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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: Compute season from available dates

David Marso
Administrator
You need to post your syntax along with frequencies pre and post RECODE.


spssdummy wrote

> When I try this, first they all get 4 (as in winter) and at the second
> attempt they all get 1, instead of 1,2,3, and 4 being assigned to the
> seasons
>
>
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

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





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
12