link average different dates to one date

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

link average different dates to one date

spssdummy
I have 8 weather conditions in my dataset and dates from 1906 to 2019 to
which these belong. For each weather variable I need to compute the average
for that day and the next 6 days and this average then belongs to that first
day. So: for 1-1-1906 I would need the average of 1 January until 7 January
and for 2-1-1906 I need the average for 2 January-8 January. This I need to
do for all weather variables.
I know how to compute averages but is there any way to do this procedure
using syntax for the whole dataset?



--
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: link average different dates to one date

David Marso
Administrator
1. Reverse the series.
2. Use PMA function in CREATE procedure.
3. Correct the value for current data point.
4. Reorder the series.
-----------

spssdummy wrote

> I have 8 weather conditions in my dataset and dates from 1906 to 2019 to
> which these belong. For each weather variable I need to compute the
> average
> for that day and the next 6 days and this average then belongs to that
> first
> day. So: for 1-1-1906 I would need the average of 1 January until 7
> January
> and for 2-1-1906 I need the average for 2 January-8 January. This I need
> to
> do for all weather variables.
> I know how to compute averages but is there any way to do this procedure
> using syntax for the whole dataset?
>
>
>
> --
> 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: link average different dates to one date

spssdummy
Could you explain how to perform steps 3 and 4?



--
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: link average different dates to one date

David Marso
Administrator
PMA with a span of 6 returns the average of the previous 6 observations but
you want to include the current one in the result.  Do the math.
Step 4 simply reverses step 1.
Hint: See definition of PMA and mean.  See SORT. See $CASENUM.
The FM is sometimes useful.


spssdummy wrote
> Could you explain how to perform steps 3 and 4?
>
>
>
> --
> 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: link average different dates to one date

spssdummy
Yeah I noticed that the current one is not included but want to know how you
can include 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: link average different dates to one date

David Marso
Administrator
Put on your thinking cap and engage your brain.

spssdummy wrote

> Yeah I noticed that the current one is not included but want to know how
> you
> can include it
>
>
>
> --
> 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: link average different dates to one date

spssdummy
I wouldn't ask if I knew how to find the solution or hadn't tried yet



--
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: link average different dates to one date

David Marso
Administrator
My previous replies are sufficient.  Reflect upon the definitions.

spssdummy wrote
> I wouldn't ask if I knew how to find the solution or hadn't tried yet
>
>
>
> --
> 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: link average different dates to one date

spssdummy
Hint: See definition of PMA and mean.  See SORT. See $CASENUM.
The FM is sometimes useful.

I used SORT to reverse dataset, and PMA to get the means for the previous 7
days. However, I need to include the day itself + 6 days after (before with
reduced dataset). $CASENUM has not helped me and I don't know what FM is.



--
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: link average different dates to one date

bdates

FM is the "Fine" Manual, the Command Syntax Reference. I think you're going to have to play/experiment with these commands in order to learn them. That's how we all learned - trial and error - and then the great AHA! Feels good.


Brian

From: SPSSX(r) Discussion <[hidden email]> on behalf of spssdummy <[hidden email]>
Sent: Tuesday, May 14, 2019 11:10:54 AM
To: [hidden email]
Subject: Re: link average different dates to one date
 
Hint: See definition of PMA and mean.  See SORT. See $CASENUM.
The FM is sometimes useful.

I used SORT to reverse dataset, and PMA to get the means for the previous 7
days. However, I need to include the day itself + 6 days after (before with
reduced dataset). $CASENUM has not helped me and I don't know what FM is.



--
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: link average different dates to one date

David Marso
Administrator
Thank you Brian.  OP has to make some independent effort here.


bdates wrote
> FM is the "Fine" Manual, the Command Syntax Reference. I think you're
> going to have to play/experiment with these commands in order to learn
> them. That's how we all learned - trial and error - and then the great
> AHA! Feels good.
>
>
> Brian
> ________________________________
> From: SPSSX(r) Discussion &lt;

> SPSSX-L@.UGA

> &gt; on behalf of spssdummy &lt;

> mischa.lenaers@

> &gt;
> Sent: Tuesday, May 14, 2019 11:10:54 AM
> To:

> SPSSX-L@.UGA

> Subject: Re: link average different dates to one date
>
> Hint: See definition of PMA and mean.  See SORT. See $CASENUM.
> The FM is sometimes useful.
>
> I used SORT to reverse dataset, and PMA to get the means for the previous
> 7
> days. However, I need to include the day itself + 6 days after (before
> with
> reduced dataset). $CASENUM has not helped me and I don't know what FM is.
>
>
>
> --
> 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: link average different dates to one date

spssdummy
In reply to this post by bdates
Great manual but I cannot find more info on PMA than I had already found (and
it doesn't include the answer as to how the current date can be included)



--
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: link average different dates to one date

David Marso
Administrator
FFS!!!
PMA(var,k) is the mean of the previous k values of var =var*/k
You want SUM(var*+var(i))/(k+1)
Where var* is the sum of the previous k values.
var(i) is the current value.
See COMPUTE command.



-----
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: link average different dates to one date

Jim Marks
In reply to this post by spssdummy
Sort in your preferred order.

Compute PMA_include EQ  MEAN.7(datevar,LAG(datevar), LAG(datevar,2), LAG(datevar,3),... LAG(datevar,6).

Check the manual to confirm the correct format for LAG (n cases) and MEAN. (number of valid cases to include) .

Jim Marks
Sr. Market Research Manager
KP National Market Research

-----Original Message-----
From: SPSSX(r) Discussion <[hidden email]> On Behalf Of spssdummy
Sent: Tuesday, May 14, 2019 11:26 AM
To: [hidden email]
Subject: Re: link average different dates to one date

Caution: This email came from outside Kaiser Permanente. Do not open attachments or click on links if you do not recognize the sender.

______________________________________________________________________
Great manual but I cannot find more info on PMA than I had already found (and it doesn't include the answer as to how the current date can be included)



--
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
NOTICE TO RECIPIENT:  If you are not the intended recipient of this e-mail, you are prohibited from sharing, copying, or otherwise using or disclosing its contents.  If you have received this e-mail in error, please notify the sender immediately by reply e-mail and permanently delete this e-mail and any attachments without reading, forwarding or saving them.  Thank you.

=====================
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: link average different dates to one date

Rich Ulrich
In reply to this post by David Marso
Or - PMA with 7 values creates exactly the /values/ that are wanted,
but they are indexed by the wrong date.  That's true whether you
sort the file into reverse order or not.

You could create them, write them out to a temp file with whatever
correction is needed to the date -- subtracting 7 (I think. Be careful
about this.) if you have the file in its original, date-order, and match
back to the original.

--
Rich Ulrich



From: SPSSX(r) Discussion <[hidden email]> on behalf of David Marso <[hidden email]>
Sent: Tuesday, May 14, 2019 11:49 AM
To: [hidden email]
Subject: Re: link average different dates to one date
 
FFS!!!
PMA(var,k) is the mean of the previous k values of var =var*/k
You want SUM(var*+var(i))/(k+1)
Where var* is the sum of the previous k values.
var(i) is the current value.
See COMPUTE command.



-----
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: link average different dates to one date

David Marso
Administrator
We need not suffer such complications and distractions.
The necessary info is right there.

Rich Ulrich wrote

> Or - PMA with 7 values creates exactly the /values/ that are wanted,
> but they are indexed by the wrong date.  That's true whether you
> sort the file into reverse order or not.
>
> You could create them, write them out to a temp file with whatever
> correction is needed to the date -- subtracting 7 (I think. Be careful
> about this.) if you have the file in its original, date-order, and match
> back to the original.
>
> --
> Rich Ulrich
>
>
> ________________________________
> From: SPSSX(r) Discussion &lt;

> SPSSX-L@.UGA

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

> david.marso@

> &gt;
> Sent: Tuesday, May 14, 2019 11:49 AM
> To:

> SPSSX-L@.UGA

> Subject: Re: link average different dates to one date
>
> FFS!!!
> PMA(var,k) is the mean of the previous k values of var =var*/k
> You want SUM(var*+var(i))/(k+1)
> Where var* is the sum of the previous k values.
> var(i) is the current value.
> See COMPUTE command.
>
>
>
> -----
> 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: link average different dates to one date

Rich Ulrich
​I would rather proof-read and check the date-correction
once, over looking at and checking the 8 variables for
typos, in their recomputing of the averages.

--
Rich Ulrich

From: SPSSX(r) Discussion <[hidden email]> on behalf of David Marso <[hidden email]>
Sent: Tuesday, May 14, 2019 12:24 PM
To: [hidden email]
Subject: Re: link average different dates to one date
 
We need not suffer such complications and distractions.
The necessary info is right there.

Rich Ulrich wrote
> Or - PMA with 7 values creates exactly the /values/ that are wanted,
> but they are indexed by the wrong date.  That's true whether you
> sort the file into reverse order or not.
>
> You could create them, write them out to a temp file with whatever
> correction is needed to the date -- subtracting 7 (I think. Be careful
> about this.) if you have the file in its original, date-order, and match
> back to the original.
>
> --
> Rich Ulrich
>
>
> ________________________________
> From: SPSSX(r) Discussion &lt;

> SPSSX-L@.UGA

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

> david.marso@

> &gt;
> Sent: Tuesday, May 14, 2019 11:49 AM
> To:

> SPSSX-L@.UGA

> Subject: Re: link average different dates to one date
>
> FFS!!!
> PMA(var,k) is the mean of the previous k values of var =var*/k
> You want SUM(var*+var(i))/(k+1)
> Where var* is the sum of the previous k values.
> var(i) is the current value.
> See COMPUTE command.
>
>
>
> -----
> 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
===================== 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: link average different dates to one date

David Marso
Administrator
Allow me to suggest LEAD (SHIFT VALUES or CREATE) following the PMA(*,7)
rather than a potentially ugly MATCH scenario.  Consider your audience.
That might be more solid than my initial proposal in case there are missing
values.  

Rich Ulrich wrote
> ​I would rather proof-read and check the date-correction
> once, over looking at and checking the 8 variables for
> typos, in their recomputing of the averages.
>
> --
> Rich Ulrich
> ________________________________
> From: SPSSX(r) Discussion &lt;

> SPSSX-L@.UGA

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

> david.marso@

> &gt;
> Sent: Tuesday, May 14, 2019 12:24 PM
> To:

> SPSSX-L@.UGA

> Subject: Re: link average different dates to one date
>
> We need not suffer such complications and distractions.
> The necessary info is right there.
>
> Rich Ulrich wrote
>> Or - PMA with 7 values creates exactly the /values/ that are wanted,
>> but they are indexed by the wrong date.  That's true whether you
>> sort the file into reverse order or not.
>>
>> You could create them, write them out to a temp file with whatever
>> correction is needed to the date -- subtracting 7 (I think. Be careful
>> about this.) if you have the file in its original, date-order, and match
>> back to the original.
>>
>> --
>> Rich Ulrich
>>
>>
>> ________________________________
>> From: SPSSX(r) Discussion &lt;
>
>> SPSSX-L@.UGA
>
>> &gt; on behalf of David Marso &lt;
>
>> david.marso@
>
>> &gt;
>> Sent: Tuesday, May 14, 2019 11:49 AM
>> To:
>
>> SPSSX-L@.UGA
>
>> Subject: Re: link average different dates to one date
>>
>> FFS!!!
>> PMA(var,k) is the mean of the previous k values of var =var*/k
>> You want SUM(var*+var(i))/(k+1)
>> Where var* is the sum of the previous k values.
>> var(i) is the current value.
>> See COMPUTE command.
>>
>>
>>
>> -----
>> 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

> 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: link average different dates to one date

David Marso
Administrator
Let us put this one to rest.  Presumably OP has pondered the musings ;-)
Missing values still may pose a problem.  Not my problem.

DATA LIST FREE / X Y.
BEGIN DATA
3 4   5 5   6 7   8 3   4 2   3 4   6 7   8 9   5 5   6 7   8 3   4 2  
3 4   2 3   4 6   7 8   5 5   6 7   8 3   4 2   3 4   6 7   8 9   5 5
END DATA.
COMPUTE ID=$CASENUM.
SORT CASES BY ID(D).
CREATE PostAVGX6 PostAVGY6=PMA(X,Y,6).
CREATE PostAVGX7 PostAVGY7=PMA(X,Y,7).
SORT CASES BY ID(A).

/* Need to suppress calculation for final cases in file */.
AGGREGATE OUTFILE=* MODE=ADDVARIABLES/BREAK=/CaseCount=N .
DO IF (CaseCount-ID GE 7 ).
+  DO REPEAT Var=x y/Var6=PostAVGX6 PostAVGY6.
+    COMPUTE Var6=SUM((Var6*6),Var)/7.
+  END REPEAT.

/* Rich Ulrich's idea of using PMA(7)           */.
/* NOTE first and last cases are problematic!!! */.
+  DO REPEAT Var=PostAVGX7 PostAVGY7/Var7=PostAVGX7_ PostAVGY7_.
+    COMPUTE Var7=LAG(Var,1).
+  END REPEAT.
END IF.
LIST.



David Marso wrote

> Allow me to suggest LEAD (SHIFT VALUES or CREATE) following the PMA(*,7)
> rather than a potentially ugly MATCH scenario.  Consider your audience.
> That might be more solid than my initial proposal in case there are
> missing
> values.  
>
> Rich Ulrich wrote
>> ​I would rather proof-read and check the date-correction
>> once, over looking at and checking the 8 variables for
>> typos, in their recomputing of the averages.
>>
>> --
>> Rich Ulrich
>> ________________________________
>> From: SPSSX(r) Discussion &lt;
>
>> SPSSX-L@.UGA
>
>> &gt; on behalf of David Marso &lt;
>
>> david.marso@
>
>> &gt;
>> Sent: Tuesday, May 14, 2019 12:24 PM
>> To:
>
>> SPSSX-L@.UGA
>
>> Subject: Re: link average different dates to one date
>>
>> We need not suffer such complications and distractions.
>> The necessary info is right there.
>>
>> Rich Ulrich wrote
>>> Or - PMA with 7 values creates exactly the /values/ that are wanted,
>>> but they are indexed by the wrong date.  That's true whether you
>>> sort the file into reverse order or not.
>>>
>>> You could create them, write them out to a temp file with whatever
>>> correction is needed to the date -- subtracting 7 (I think. Be careful
>>> about this.) if you have the file in its original, date-order, and match
>>> back to the original.
>>>
>>> --
>>> Rich Ulrich
>>>
>>>
>>> ________________________________
>>> From: SPSSX(r) Discussion &lt;
>>
>>> SPSSX-L@.UGA
>>
>>> &gt; on behalf of David Marso &lt;
>>
>>> david.marso@
>>
>>> &gt;
>>> Sent: Tuesday, May 14, 2019 11:49 AM
>>> To:
>>
>>> SPSSX-L@.UGA
>>
>>> Subject: Re: link average different dates to one date
>>>
>>> FFS!!!
>>> PMA(var,k) is the mean of the previous k values of var =var*/k
>>> You want SUM(var*+var(i))/(k+1)
>>> Where var* is the sum of the previous k values.
>>> var(i) is the current value.
>>> See COMPUTE command.
>>>
>>>
>>>
>>> -----
>>> 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
>
>> 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





-----
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?"