Fun with SPSS - but having an issue

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

Fun with SPSS - but having an issue

Timothy Hennigar

Ok doing something for FUN and I am quite perplexed!!!!

 

I am using MLB data for a pool – trying to come up with some data summarization …

(methodologically sound or not .. lafff)

 

I am using what I think is EXACTLY (with a small calc. change) same code in 2 separate

locations in my program and its working in one place and not the other.

 

 

THIS WORKS

 

(here I just want to adjust the score I calculated for Hitters by the

record of the team he plays on, the division (unbalanced sched), ball park.)

 

FRE   Ovr_MLBT.

DESC  Ovr_scr

   / STATS=RANGE MIN MAX

.

**                                              RECORD    DIV    BP  .

IF (Ovr_MLBT ="BAL") nOvr_scr = Ovr_scr * (1 + ( 96/162) + 0.15 + 0.10 ).

IF (Ovr_MLBT ="BOS") nOvr_scr = Ovr_scr * (1 + ( 71/162) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="CHW") nOvr_scr = Ovr_scr * (1 + ( 73/162) + 0.10 + 0.10 ).

IF (Ovr_MLBT ="CLE") nOvr_scr = Ovr_scr * (1 + ( 85/162) + 0.10 + 0.10 ).

IF (Ovr_MLBT ="DET") nOvr_scr = Ovr_scr * (1 + ( 90/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="HOU") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="KC" ) nOvr_scr = Ovr_scr * (1 + ( 89/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="LAA") nOvr_scr = Ovr_scr * (1 + ( 98/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="MIN") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="NYY") nOvr_scr = Ovr_scr * (1 + ( 84/162) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="OAK") nOvr_scr = Ovr_scr * (1 + ( 88/162) + 0.05 + 0.05 ).

IF (Ovr_MLBT ="SEA") nOvr_scr = Ovr_scr * (1 + ( 87/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="TB" ) nOvr_scr = Ovr_scr * (1 + ( 77/163) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="TEX") nOvr_scr = Ovr_scr * (1 + ( 67/163) + 0.05 + 0.05 ).

IF (Ovr_MLBT ="TOR") nOvr_scr = Ovr_scr * (1 + ( 83/162) + 0.15 + 0.15 ).

EXECUTE.

DESC  Ovr_scr nOvr_scr

   / STATS=RANGE MIN MAX

.

 

 

 

 

THIS DOES NOT WORK (the new varaiable is not created).

 

(doing same thing as above BUT for pitchers)

 

 

FRE Ovr_MLBT.

DESC  Ovr_scr

   / STATS=RANGE MIN MAX

.

EXECUTE.

IF (Ovr_MLBT ="BAL") nOvr_scr = Ovr_scr * (1 + ( 96/162) + 0.15 - 0.10 ).

IF (Ovr_MLBT ="BOS") nOvr_scr = Ovr_scr * (1 + ( 71/162) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="CHW") nOvr_scr = Ovr_scr * (1 + ( 73/162) + 0.10 - 0.10 ).

IF (Ovr_MLBT ="CLE") nOvr_scr = Ovr_scr * (1 + ( 85/162) + 0.10 - 0.10 ).

IF (Ovr_MLBT ="DET") nOvr_scr = Ovr_scr * (1 + ( 90/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="HOU") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="KC")  nOvr_scr = Ovr_scr * (1 + ( 89/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="LAA") nOvr_scr = Ovr_scr * (1 + ( 98/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="MIN") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="NYY") nOvr_scr = Ovr_scr * (1 + ( 84/162) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="OAK") nOvr_scr = Ovr_scr * (1 + ( 88/162) + 0.05 - 0.05 ).

IF (Ovr_MLBT ="SEA") nOvr_scr = Ovr_scr * (1 + ( 87/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="TB")  nOvr_scr = Ovr_scr * (1 + ( 77/163) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="TEX") nOvr_scr = Ovr_scr * (1 + ( 67/163) + 0.05 - 0.05 ).

IF (Ovr_MLBT ="TOR") nOvr_scr = Ovr_scr * (1 + ( 83/162) + 0.15 - 0.15 ).

EXECUTE.

DESC    Ovr_scr nOvr_scr

   / STATS=RANGE MIN MAX

.

 

 

 

 

 

 

 

Thanks!

 

*********************************

Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.

 

===================== 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: Fun with SPSS - but having an issue

Maguin, Eugene

Two blocks of code with a difference in the computation, which I see. Unless there are some do ifs surrounding those blocks, the entire dataset should flow through the first block, creating the new variable and computing the value per the formula. The entire dataset should flow through the second block and replace the previously computed value with the newly computed value.

 

Is that what you are seeing? If not, define/illustrate in terms of example data the phrase “working in one place and not the other”

 

Gene Maguin

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Timothy Hennigar
Sent: Wednesday, August 10, 2016 9:08 AM
To: [hidden email]
Subject: Fun with SPSS - but having an issue

 

Ok doing something for FUN and I am quite perplexed!!!!

 

I am using MLB data for a pool – trying to come up with some data summarization …

(methodologically sound or not .. lafff)

 

I am using what I think is EXACTLY (with a small calc. change) same code in 2 separate

locations in my program and its working in one place and not the other.

 

 

THIS WORKS

 

(here I just want to adjust the score I calculated for Hitters by the

record of the team he plays on, the division (unbalanced sched), ball park.)

 

FRE   Ovr_MLBT.

DESC  Ovr_scr

   / STATS=RANGE MIN MAX

.

**                                              RECORD    DIV    BP  .

IF (Ovr_MLBT ="BAL") nOvr_scr = Ovr_scr * (1 + ( 96/162) + 0.15 + 0.10 ).

IF (Ovr_MLBT ="BOS") nOvr_scr = Ovr_scr * (1 + ( 71/162) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="CHW") nOvr_scr = Ovr_scr * (1 + ( 73/162) + 0.10 + 0.10 ).

IF (Ovr_MLBT ="CLE") nOvr_scr = Ovr_scr * (1 + ( 85/162) + 0.10 + 0.10 ).

IF (Ovr_MLBT ="DET") nOvr_scr = Ovr_scr * (1 + ( 90/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="HOU") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="KC" ) nOvr_scr = Ovr_scr * (1 + ( 89/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="LAA") nOvr_scr = Ovr_scr * (1 + ( 98/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="MIN") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="NYY") nOvr_scr = Ovr_scr * (1 + ( 84/162) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="OAK") nOvr_scr = Ovr_scr * (1 + ( 88/162) + 0.05 + 0.05 ).

IF (Ovr_MLBT ="SEA") nOvr_scr = Ovr_scr * (1 + ( 87/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="TB" ) nOvr_scr = Ovr_scr * (1 + ( 77/163) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="TEX") nOvr_scr = Ovr_scr * (1 + ( 67/163) + 0.05 + 0.05 ).

IF (Ovr_MLBT ="TOR") nOvr_scr = Ovr_scr * (1 + ( 83/162) + 0.15 + 0.15 ).

EXECUTE.

DESC  Ovr_scr nOvr_scr

   / STATS=RANGE MIN MAX

.

 

 

 

 

THIS DOES NOT WORK (the new varaiable is not created).

 

(doing same thing as above BUT for pitchers)

 

 

FRE Ovr_MLBT.

DESC  Ovr_scr

   / STATS=RANGE MIN MAX

.

EXECUTE.

IF (Ovr_MLBT ="BAL") nOvr_scr = Ovr_scr * (1 + ( 96/162) + 0.15 - 0.10 ).

IF (Ovr_MLBT ="BOS") nOvr_scr = Ovr_scr * (1 + ( 71/162) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="CHW") nOvr_scr = Ovr_scr * (1 + ( 73/162) + 0.10 - 0.10 ).

IF (Ovr_MLBT ="CLE") nOvr_scr = Ovr_scr * (1 + ( 85/162) + 0.10 - 0.10 ).

IF (Ovr_MLBT ="DET") nOvr_scr = Ovr_scr * (1 + ( 90/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="HOU") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="KC")  nOvr_scr = Ovr_scr * (1 + ( 89/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="LAA") nOvr_scr = Ovr_scr * (1 + ( 98/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="MIN") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="NYY") nOvr_scr = Ovr_scr * (1 + ( 84/162) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="OAK") nOvr_scr = Ovr_scr * (1 + ( 88/162) + 0.05 - 0.05 ).

IF (Ovr_MLBT ="SEA") nOvr_scr = Ovr_scr * (1 + ( 87/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="TB")  nOvr_scr = Ovr_scr * (1 + ( 77/163) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="TEX") nOvr_scr = Ovr_scr * (1 + ( 67/163) + 0.05 - 0.05 ).

IF (Ovr_MLBT ="TOR") nOvr_scr = Ovr_scr * (1 + ( 83/162) + 0.15 - 0.15 ).

EXECUTE.

DESC    Ovr_scr nOvr_scr

   / STATS=RANGE MIN MAX

.

 

 

 

 

 

 

 

Thanks!

 

*********************************

Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.

 

===================== 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: Fun with SPSS - but having an issue

David Marso
Administrator
In reply to this post by Timothy Hennigar
Perhaps you need to attach a subset of the actual data?
Do you get any error messages/warnings?
For this sort of thing you are much better off using a TABLE and matching and then the compute syntax becomes a 1 liner.
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: Fun with SPSS - but having an issue

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

Well, that variable, Ovr_MBT.. is not in either dataset. MLBTEAM is; so the Ovr… variable must have been created by you. Could there be a computation error there? Or, why aren’t you using MLBTEAM?

Gene Maguin

 

From: Timothy Hennigar [mailto:[hidden email]]
Sent: Wednesday, August 10, 2016 9:49 AM
To: Maguin, Eugene <[hidden email]>; David Marso <[hidden email]>
Subject: RE: Fun with SPSS - but having an issue

 

It has something to do with the alpha variable  Ovr_MLBT.. that is why I freq it before

using it –it is there – A5 ..  this does work on different files as it runs through

the syntax – not sure why yet cause when I am working on the hitter portion its fine

but not when I get to the pitchers

 

 

 

 

 

 

Thanks!

 

[hidden email]

[hidden email]

 

(Tor) 416-947-7807

(Loc)  905-987-3250

*********************************

Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.

 

 

From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Maguin, Eugene
Sent: Wednesday, August 10, 2016 09:30 AM
To: [hidden email]
Subject: Re: Fun with SPSS - but having an issue

 

Two blocks of code with a difference in the computation, which I see. Unless there are some do ifs surrounding those blocks, the entire dataset should flow through the first block, creating the new variable and computing the value per the formula. The entire dataset should flow through the second block and replace the previously computed value with the newly computed value.

 

Is that what you are seeing? If not, define/illustrate in terms of example data the phrase “working in one place and not the other”

 

Gene Maguin

 

From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Timothy Hennigar
Sent: Wednesday, August 10, 2016 9:08 AM
To: [hidden email]
Subject: Fun with SPSS - but having an issue

 

Ok doing something for FUN and I am quite perplexed!!!!

 

I am using MLB data for a pool – trying to come up with some data summarization …

(methodologically sound or not .. lafff)

 

I am using what I think is EXACTLY (with a small calc. change) same code in 2 separate

locations in my program and its working in one place and not the other.

 

 

THIS WORKS

 

(here I just want to adjust the score I calculated for Hitters by the

record of the team he plays on, the division (unbalanced sched), ball park.)

 

FRE   Ovr_MLBT.

DESC  Ovr_scr

   / STATS=RANGE MIN MAX

.

**                                              RECORD    DIV    BP  .

IF (Ovr_MLBT ="BAL") nOvr_scr = Ovr_scr * (1 + ( 96/162) + 0.15 + 0.10 ).

IF (Ovr_MLBT ="BOS") nOvr_scr = Ovr_scr * (1 + ( 71/162) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="CHW") nOvr_scr = Ovr_scr * (1 + ( 73/162) + 0.10 + 0.10 ).

IF (Ovr_MLBT ="CLE") nOvr_scr = Ovr_scr * (1 + ( 85/162) + 0.10 + 0.10 ).

IF (Ovr_MLBT ="DET") nOvr_scr = Ovr_scr * (1 + ( 90/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="HOU") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="KC" ) nOvr_scr = Ovr_scr * (1 + ( 89/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="LAA") nOvr_scr = Ovr_scr * (1 + ( 98/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="MIN") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="NYY") nOvr_scr = Ovr_scr * (1 + ( 84/162) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="OAK") nOvr_scr = Ovr_scr * (1 + ( 88/162) + 0.05 + 0.05 ).

IF (Ovr_MLBT ="SEA") nOvr_scr = Ovr_scr * (1 + ( 87/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="TB" ) nOvr_scr = Ovr_scr * (1 + ( 77/163) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="TEX") nOvr_scr = Ovr_scr * (1 + ( 67/163) + 0.05 + 0.05 ).

IF (Ovr_MLBT ="TOR") nOvr_scr = Ovr_scr * (1 + ( 83/162) + 0.15 + 0.15 ).

EXECUTE.

DESC  Ovr_scr nOvr_scr

   / STATS=RANGE MIN MAX

.

 

 

 

 

THIS DOES NOT WORK (the new varaiable is not created).

 

(doing same thing as above BUT for pitchers)

 

 

FRE Ovr_MLBT.

DESC  Ovr_scr

   / STATS=RANGE MIN MAX

.

EXECUTE.

IF (Ovr_MLBT ="BAL") nOvr_scr = Ovr_scr * (1 + ( 96/162) + 0.15 - 0.10 ).

IF (Ovr_MLBT ="BOS") nOvr_scr = Ovr_scr * (1 + ( 71/162) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="CHW") nOvr_scr = Ovr_scr * (1 + ( 73/162) + 0.10 - 0.10 ).

IF (Ovr_MLBT ="CLE") nOvr_scr = Ovr_scr * (1 + ( 85/162) + 0.10 - 0.10 ).

IF (Ovr_MLBT ="DET") nOvr_scr = Ovr_scr * (1 + ( 90/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="HOU") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="KC")  nOvr_scr = Ovr_scr * (1 + ( 89/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="LAA") nOvr_scr = Ovr_scr * (1 + ( 98/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="MIN") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="NYY") nOvr_scr = Ovr_scr * (1 + ( 84/162) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="OAK") nOvr_scr = Ovr_scr * (1 + ( 88/162) + 0.05 - 0.05 ).

IF (Ovr_MLBT ="SEA") nOvr_scr = Ovr_scr * (1 + ( 87/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="TB")  nOvr_scr = Ovr_scr * (1 + ( 77/163) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="TEX") nOvr_scr = Ovr_scr * (1 + ( 67/163) + 0.05 - 0.05 ).

IF (Ovr_MLBT ="TOR") nOvr_scr = Ovr_scr * (1 + ( 83/162) + 0.15 - 0.15 ).

EXECUTE.

DESC    Ovr_scr nOvr_scr

   / STATS=RANGE MIN MAX

.

 

 

 

 

 

 

 

Thanks!

 

*********************************

Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.

 

===================== 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: Fun with SPSS - but having an issue

Christopher Stride
In reply to this post by Maguin, Eugene

Can't diagnose the issue without knowing if you have an error message and if so what it says - but the code could be a bit simpler by using a Do repeat loop of this form: (illustrated for 3 teams but could extend to all)

do repeat
 i = "BAL" "BOS" "CHW"
/j = 96 71 73
/k = 0.15 0.15 0.1 
/l =  0.1 0.15 0.1.
if Ovr_MLBT = i nOvr_scr = (1 + (j/162) + k + l).
end repeat.
exe.






On 10/08/2016 14:30, Maguin, Eugene wrote:

Two blocks of code with a difference in the computation, which I see. Unless there are some do ifs surrounding those blocks, the entire dataset should flow through the first block, creating the new variable and computing the value per the formula. The entire dataset should flow through the second block and replace the previously computed value with the newly computed value.

 

Is that what you are seeing? If not, define/illustrate in terms of example data the phrase “working in one place and not the other”

 

Gene Maguin

 

From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Timothy Hennigar
Sent: Wednesday, August 10, 2016 9:08 AM
To: [hidden email]
Subject: Fun with SPSS - but having an issue

 

Ok doing something for FUN and I am quite perplexed!!!!

 

I am using MLB data for a pool – trying to come up with some data summarization …

(methodologically sound or not .. lafff)

 

I am using what I think is EXACTLY (with a small calc. change) same code in 2 separate

locations in my program and its working in one place and not the other.

 

 

THIS WORKS

 

(here I just want to adjust the score I calculated for Hitters by the

record of the team he plays on, the division (unbalanced sched), ball park.)

 

FRE   Ovr_MLBT.

DESC  Ovr_scr

   / STATS=RANGE MIN MAX

.

**                                              RECORD    DIV    BP  .

IF (Ovr_MLBT ="BAL") nOvr_scr = Ovr_scr * (1 + ( 96/162) + 0.15 + 0.10 ).

IF (Ovr_MLBT ="BOS") nOvr_scr = Ovr_scr * (1 + ( 71/162) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="CHW") nOvr_scr = Ovr_scr * (1 + ( 73/162) + 0.10 + 0.10 ).

IF (Ovr_MLBT ="CLE") nOvr_scr = Ovr_scr * (1 + ( 85/162) + 0.10 + 0.10 ).

IF (Ovr_MLBT ="DET") nOvr_scr = Ovr_scr * (1 + ( 90/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="HOU") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="KC" ) nOvr_scr = Ovr_scr * (1 + ( 89/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="LAA") nOvr_scr = Ovr_scr * (1 + ( 98/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="MIN") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="NYY") nOvr_scr = Ovr_scr * (1 + ( 84/162) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="OAK") nOvr_scr = Ovr_scr * (1 + ( 88/162) + 0.05 + 0.05 ).

IF (Ovr_MLBT ="SEA") nOvr_scr = Ovr_scr * (1 + ( 87/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="TB" ) nOvr_scr = Ovr_scr * (1 + ( 77/163) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="TEX") nOvr_scr = Ovr_scr * (1 + ( 67/163) + 0.05 + 0.05 ).

IF (Ovr_MLBT ="TOR") nOvr_scr = Ovr_scr * (1 + ( 83/162) + 0.15 + 0.15 ).

EXECUTE.

DESC  Ovr_scr nOvr_scr

   / STATS=RANGE MIN MAX

.

 

 

 

 

THIS DOES NOT WORK (the new varaiable is not created).

 

(doing same thing as above BUT for pitchers)

 

 

FRE Ovr_MLBT.

DESC  Ovr_scr

   / STATS=RANGE MIN MAX

.

EXECUTE.

IF (Ovr_MLBT ="BAL") nOvr_scr = Ovr_scr * (1 + ( 96/162) + 0.15 - 0.10 ).

IF (Ovr_MLBT ="BOS") nOvr_scr = Ovr_scr * (1 + ( 71/162) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="CHW") nOvr_scr = Ovr_scr * (1 + ( 73/162) + 0.10 - 0.10 ).

IF (Ovr_MLBT ="CLE") nOvr_scr = Ovr_scr * (1 + ( 85/162) + 0.10 - 0.10 ).

IF (Ovr_MLBT ="DET") nOvr_scr = Ovr_scr * (1 + ( 90/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="HOU") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="KC")  nOvr_scr = Ovr_scr * (1 + ( 89/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="LAA") nOvr_scr = Ovr_scr * (1 + ( 98/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="MIN") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="NYY") nOvr_scr = Ovr_scr * (1 + ( 84/162) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="OAK") nOvr_scr = Ovr_scr * (1 + ( 88/162) + 0.05 - 0.05 ).

IF (Ovr_MLBT ="SEA") nOvr_scr = Ovr_scr * (1 + ( 87/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="TB")  nOvr_scr = Ovr_scr * (1 + ( 77/163) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="TEX") nOvr_scr = Ovr_scr * (1 + ( 67/163) + 0.05 - 0.05 ).

IF (Ovr_MLBT ="TOR") nOvr_scr = Ovr_scr * (1 + ( 83/162) + 0.15 - 0.15 ).

EXECUTE.

DESC    Ovr_scr nOvr_scr

   / STATS=RANGE MIN MAX

.

 

 

 

 

 

 

 

Thanks!

 

*********************************

Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.

 

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

-- 

--

Dr Chris Stride, C. Stat, Statistician, Institute of Work Psychology,
University of Sheffield
Telephone: 0114 2223262
Fax: 0114 2727206

"Figure It Out"
Statistical Consultancy and Training Service for Social Scientists

Visit www.figureitout.org.uk for details of my consultancy services, and
forthcoming training courses, which are also available on an in-house basis:

 - Data management using SPSS syntax
 - Advanced SPSS syntax and SPSS macros
 - Testing for Mediation and Moderation using SPSS
 - Multi-level Modelling using SPSS
 - Introduction to Structural Equation Modelling using Mplus
 - Testing for Mediation and Moderation using Mplus
 - Multi-level Modelling using Mplus
 - Latent Growth Curve Modelling using Mplus 
===================== 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: Fun with SPSS - but having an issue

Christopher Stride

Given lack of an error message in the output you sent me, the code itself is sound, so must be the data.

My best guess is that somehow in the second file your teams are not coded in the same way as in the first, i.e. they are not called exactly "BAL", "BOS" etc, (maybe they are not all in upper case, or there's a trailing blank?) so the 'if' statements are not picking them up, so no non-missing values are being created.





On 10/08/2016 16:07, Timothy Hennigar wrote:

No errors no warnings .. for my hitters it works fine but for pitchers it does not ..

 

The code wasn’t written to be parsimonious .. laff..   (I get the value of that at times .. but here

just getting out thoughts at the moment).

 

 

I’ll attached the output for the 2 little sections

Pass1 hitters

Pass2 pitchers

 

 

 

 

 

 

Thanks!

 

[hidden email]

[hidden email]

 

(Tor) 416-947-7807

(Loc)  905-987-3250

*********************************

Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.

 

 

From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Dr Chris Stride
Sent: Wednesday, August 10, 2016 10:54 AM
To: [hidden email]
Subject: Re: Fun with SPSS - but having an issue

 

Can't diagnose the issue without knowing if you have an error message and if so what it says - but the code could be a bit simpler by using a Do repeat loop of this form: (illustrated for 3 teams but could extend to all)

do repeat
 i = "BAL" "BOS" "CHW"
/j = 96 71 73
/k = 0.15 0.15 0.1 
/l =  0.1 0.15 0.1.
if Ovr_MLBT = i nOvr_scr = (1 + (j/162) + k + l).
end repeat.
exe.





On 10/08/2016 14:30, Maguin, Eugene wrote:

Two blocks of code with a difference in the computation, which I see. Unless there are some do ifs surrounding those blocks, the entire dataset should flow through the first block, creating the new variable and computing the value per the formula. The entire dataset should flow through the second block and replace the previously computed value with the newly computed value.

 

Is that what you are seeing? If not, define/illustrate in terms of example data the phrase “working in one place and not the other”

 

Gene Maguin

 

From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Timothy Hennigar
Sent: Wednesday, August 10, 2016 9:08 AM
To: [hidden email]
Subject: Fun with SPSS - but having an issue

 

Ok doing something for FUN and I am quite perplexed!!!!

 

I am using MLB data for a pool – trying to come up with some data summarization …

(methodologically sound or not .. lafff)

 

I am using what I think is EXACTLY (with a small calc. change) same code in 2 separate

locations in my program and its working in one place and not the other.

 

 

THIS WORKS

 

(here I just want to adjust the score I calculated for Hitters by the

record of the team he plays on, the division (unbalanced sched), ball park.)

 

FRE   Ovr_MLBT.

DESC  Ovr_scr

   / STATS=RANGE MIN MAX

.

**                                              RECORD    DIV    BP  .

IF (Ovr_MLBT ="BAL") nOvr_scr = Ovr_scr * (1 + ( 96/162) + 0.15 + 0.10 ).

IF (Ovr_MLBT ="BOS") nOvr_scr = Ovr_scr * (1 + ( 71/162) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="CHW") nOvr_scr = Ovr_scr * (1 + ( 73/162) + 0.10 + 0.10 ).

IF (Ovr_MLBT ="CLE") nOvr_scr = Ovr_scr * (1 + ( 85/162) + 0.10 + 0.10 ).

IF (Ovr_MLBT ="DET") nOvr_scr = Ovr_scr * (1 + ( 90/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="HOU") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="KC" ) nOvr_scr = Ovr_scr * (1 + ( 89/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="LAA") nOvr_scr = Ovr_scr * (1 + ( 98/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="MIN") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="NYY") nOvr_scr = Ovr_scr * (1 + ( 84/162) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="OAK") nOvr_scr = Ovr_scr * (1 + ( 88/162) + 0.05 + 0.05 ).

IF (Ovr_MLBT ="SEA") nOvr_scr = Ovr_scr * (1 + ( 87/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="TB" ) nOvr_scr = Ovr_scr * (1 + ( 77/163) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="TEX") nOvr_scr = Ovr_scr * (1 + ( 67/163) + 0.05 + 0.05 ).

IF (Ovr_MLBT ="TOR") nOvr_scr = Ovr_scr * (1 + ( 83/162) + 0.15 + 0.15 ).

EXECUTE.

DESC  Ovr_scr nOvr_scr

   / STATS=RANGE MIN MAX

.

 

 

 

 

THIS DOES NOT WORK (the new varaiable is not created).

 

(doing same thing as above BUT for pitchers)

 

 

FRE Ovr_MLBT.

DESC  Ovr_scr

   / STATS=RANGE MIN MAX

.

EXECUTE.

IF (Ovr_MLBT ="BAL") nOvr_scr = Ovr_scr * (1 + ( 96/162) + 0.15 - 0.10 ).

IF (Ovr_MLBT ="BOS") nOvr_scr = Ovr_scr * (1 + ( 71/162) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="CHW") nOvr_scr = Ovr_scr * (1 + ( 73/162) + 0.10 - 0.10 ).

IF (Ovr_MLBT ="CLE") nOvr_scr = Ovr_scr * (1 + ( 85/162) + 0.10 - 0.10 ).

IF (Ovr_MLBT ="DET") nOvr_scr = Ovr_scr * (1 + ( 90/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="HOU") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="KC")  nOvr_scr = Ovr_scr * (1 + ( 89/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="LAA") nOvr_scr = Ovr_scr * (1 + ( 98/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="MIN") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="NYY") nOvr_scr = Ovr_scr * (1 + ( 84/162) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="OAK") nOvr_scr = Ovr_scr * (1 + ( 88/162) + 0.05 - 0.05 ).

IF (Ovr_MLBT ="SEA") nOvr_scr = Ovr_scr * (1 + ( 87/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="TB")  nOvr_scr = Ovr_scr * (1 + ( 77/163) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="TEX") nOvr_scr = Ovr_scr * (1 + ( 67/163) + 0.05 - 0.05 ).

IF (Ovr_MLBT ="TOR") nOvr_scr = Ovr_scr * (1 + ( 83/162) + 0.15 - 0.15 ).

EXECUTE.

DESC    Ovr_scr nOvr_scr

   / STATS=RANGE MIN MAX

.

 

 

 

 

 

 

 

Thanks!

 

*********************************

Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.

 

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



-- 
 
--
 
Dr Chris Stride, C. Stat, Statistician, Institute of Work Psychology,
University of Sheffield
Telephone: 0114 2223262
Fax: 0114 2727206
 
"Figure It Out"
Statistical Consultancy and Training Service for Social Scientists
 
Visit www.figureitout.org.uk for details of my consultancy services, and
forthcoming training courses, which are also available on an in-house basis:
 
 - Data management using SPSS syntax
 - Advanced SPSS syntax and SPSS macros
 - Testing for Mediation and Moderation using SPSS
 - Multi-level Modelling using SPSS
 - Introduction to Structural Equation Modelling using Mplus
 - Testing for Mediation and Moderation using Mplus
 - Multi-level Modelling using Mplus
 - Latent Growth Curve Modelling using Mplus 

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


-- 

--

Dr Chris Stride, C. Stat, Statistician, Institute of Work Psychology,
University of Sheffield
Telephone: 0114 2223262
Fax: 0114 2727206

"Figure It Out"
Statistical Consultancy and Training Service for Social Scientists

Visit www.figureitout.org.uk for details of my consultancy services, and
forthcoming training courses, which are also available on an in-house basis:

 - Data management using SPSS syntax
 - Advanced SPSS syntax and SPSS macros
 - Testing for Mediation and Moderation using SPSS
 - Multi-level Modelling using SPSS
 - Introduction to Structural Equation Modelling using Mplus
 - Testing for Mediation and Moderation using Mplus
 - Multi-level Modelling using Mplus
 - Latent Growth Curve Modelling using Mplus 
===================== 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: Fun with SPSS - but having an issue

Maguin, Eugene

I understand your point about differences. I’m not sure that a trailing blank matters because when strings of different lengths are compared, the shorter strings are right padded with blanks to a common length. So, rather than blanks/spaces on the right, how about a space(s) on the left. Continuing with that idea, have you examined/compared the MLBTeam values going into the aggregate across files. Specifically, when you select a MLBTeam value and it appears in the data window edit line, does the character location match the character count and is that correspondence the same across both datasets?

Gene Maguin

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Dr Chris Stride
Sent: Wednesday, August 10, 2016 11:29 AM
To: [hidden email]
Subject: Re: Fun with SPSS - but having an issue

 

Given lack of an error message in the output you sent me, the code itself is sound, so must be the data.

My best guess is that somehow in the second file your teams are not coded in the same way as in the first, i.e. they are not called exactly "BAL", "BOS" etc, (maybe they are not all in upper case, or there's a trailing blank?) so the 'if' statements are not picking them up, so no non-missing values are being created.

 

 

 

 

On 10/08/2016 16:07, Timothy Hennigar wrote:

No errors no warnings .. for my hitters it works fine but for pitchers it does not ..

 

The code wasn’t written to be parsimonious .. laff..   (I get the value of that at times .. but here

just getting out thoughts at the moment).

 

 

I’ll attached the output for the 2 little sections

Pass1 hitters

Pass2 pitchers

 

 

 

 

 

 

Thanks!

 

[hidden email]

[hidden email]

 

(Tor) 416-947-7807

(Loc)  905-987-3250

*********************************

Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.

 

 

From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Dr Chris Stride
Sent: Wednesday, August 10, 2016 10:54 AM
To:
[hidden email]
Subject: Re: Fun with SPSS - but having an issue

 

Can't diagnose the issue without knowing if you have an error message and if so what it says - but the code could be a bit simpler by using a Do repeat loop of this form: (illustrated for 3 teams but could extend to all)

do repeat
 i = "BAL" "BOS" "CHW"
/j = 96 71 73
/k = 0.15 0.15 0.1 
/l =  0.1 0.15 0.1.
if Ovr_MLBT = i nOvr_scr = (1 + (j/162) + k + l).
end repeat.
exe.






On 10/08/2016 14:30, Maguin, Eugene wrote:

Two blocks of code with a difference in the computation, which I see. Unless there are some do ifs surrounding those blocks, the entire dataset should flow through the first block, creating the new variable and computing the value per the formula. The entire dataset should flow through the second block and replace the previously computed value with the newly computed value.

 

Is that what you are seeing? If not, define/illustrate in terms of example data the phrase “working in one place and not the other”

 

Gene Maguin

 

From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Timothy Hennigar
Sent: Wednesday, August 10, 2016 9:08 AM
To: [hidden email]
Subject: Fun with SPSS - but having an issue

 

Ok doing something for FUN and I am quite perplexed!!!!

 

I am using MLB data for a pool – trying to come up with some data summarization …

(methodologically sound or not .. lafff)

 

I am using what I think is EXACTLY (with a small calc. change) same code in 2 separate

locations in my program and its working in one place and not the other.

 

 

THIS WORKS

 

(here I just want to adjust the score I calculated for Hitters by the

record of the team he plays on, the division (unbalanced sched), ball park.)

 

FRE   Ovr_MLBT.

DESC  Ovr_scr

   / STATS=RANGE MIN MAX

.

**                                              RECORD    DIV    BP  .

IF (Ovr_MLBT ="BAL") nOvr_scr = Ovr_scr * (1 + ( 96/162) + 0.15 + 0.10 ).

IF (Ovr_MLBT ="BOS") nOvr_scr = Ovr_scr * (1 + ( 71/162) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="CHW") nOvr_scr = Ovr_scr * (1 + ( 73/162) + 0.10 + 0.10 ).

IF (Ovr_MLBT ="CLE") nOvr_scr = Ovr_scr * (1 + ( 85/162) + 0.10 + 0.10 ).

IF (Ovr_MLBT ="DET") nOvr_scr = Ovr_scr * (1 + ( 90/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="HOU") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="KC" ) nOvr_scr = Ovr_scr * (1 + ( 89/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="LAA") nOvr_scr = Ovr_scr * (1 + ( 98/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="MIN") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="NYY") nOvr_scr = Ovr_scr * (1 + ( 84/162) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="OAK") nOvr_scr = Ovr_scr * (1 + ( 88/162) + 0.05 + 0.05 ).

IF (Ovr_MLBT ="SEA") nOvr_scr = Ovr_scr * (1 + ( 87/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="TB" ) nOvr_scr = Ovr_scr * (1 + ( 77/163) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="TEX") nOvr_scr = Ovr_scr * (1 + ( 67/163) + 0.05 + 0.05 ).

IF (Ovr_MLBT ="TOR") nOvr_scr = Ovr_scr * (1 + ( 83/162) + 0.15 + 0.15 ).

EXECUTE.

DESC  Ovr_scr nOvr_scr

   / STATS=RANGE MIN MAX

.

 

 

 

 

THIS DOES NOT WORK (the new varaiable is not created).

 

(doing same thing as above BUT for pitchers)

 

 

FRE Ovr_MLBT.

DESC  Ovr_scr

   / STATS=RANGE MIN MAX

.

EXECUTE.

IF (Ovr_MLBT ="BAL") nOvr_scr = Ovr_scr * (1 + ( 96/162) + 0.15 - 0.10 ).

IF (Ovr_MLBT ="BOS") nOvr_scr = Ovr_scr * (1 + ( 71/162) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="CHW") nOvr_scr = Ovr_scr * (1 + ( 73/162) + 0.10 - 0.10 ).

IF (Ovr_MLBT ="CLE") nOvr_scr = Ovr_scr * (1 + ( 85/162) + 0.10 - 0.10 ).

IF (Ovr_MLBT ="DET") nOvr_scr = Ovr_scr * (1 + ( 90/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="HOU") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="KC")  nOvr_scr = Ovr_scr * (1 + ( 89/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="LAA") nOvr_scr = Ovr_scr * (1 + ( 98/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="MIN") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="NYY") nOvr_scr = Ovr_scr * (1 + ( 84/162) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="OAK") nOvr_scr = Ovr_scr * (1 + ( 88/162) + 0.05 - 0.05 ).

IF (Ovr_MLBT ="SEA") nOvr_scr = Ovr_scr * (1 + ( 87/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="TB")  nOvr_scr = Ovr_scr * (1 + ( 77/163) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="TEX") nOvr_scr = Ovr_scr * (1 + ( 67/163) + 0.05 - 0.05 ).

IF (Ovr_MLBT ="TOR") nOvr_scr = Ovr_scr * (1 + ( 83/162) + 0.15 - 0.15 ).

EXECUTE.

DESC    Ovr_scr nOvr_scr

   / STATS=RANGE MIN MAX

.

 

 

 

 

 

 

 

Thanks!

 

*********************************

Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.

 

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




-- 
 
--
 
Dr Chris Stride, C. Stat, Statistician, Institute of Work Psychology,
University of Sheffield
Telephone: 0114 2223262
Fax: 0114 2727206
 
"Figure It Out"
Statistical Consultancy and Training Service for Social Scientists
 
Visit www.figureitout.org.uk for details of my consultancy services, and
forthcoming training courses, which are also available on an in-house basis:
 
 - Data management using SPSS syntax
 - Advanced SPSS syntax and SPSS macros
 - Testing for Mediation and Moderation using SPSS
 - Multi-level Modelling using SPSS
 - Introduction to Structural Equation Modelling using Mplus
 - Testing for Mediation and Moderation using Mplus
 - Multi-level Modelling using Mplus
 - Latent Growth Curve Modelling using Mplus 

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



-- 
 
--
 
Dr Chris Stride, C. Stat, Statistician, Institute of Work Psychology,
University of Sheffield
Telephone: 0114 2223262
Fax: 0114 2727206
 
"Figure It Out"
Statistical Consultancy and Training Service for Social Scientists
 
Visit www.figureitout.org.uk for details of my consultancy services, and
forthcoming training courses, which are also available on an in-house basis:
 
 - Data management using SPSS syntax
 - Advanced SPSS syntax and SPSS macros
 - Testing for Mediation and Moderation using SPSS
 - Multi-level Modelling using SPSS
 - Introduction to Structural Equation Modelling using Mplus
 - Testing for Mediation and Moderation using Mplus
 - Multi-level Modelling using Mplus
 - Latent Growth Curve Modelling using Mplus 

===================== 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: Fun with SPSS - but having an issue

Maguin, Eugene

In that case, the ltrim function would have been useful before the aggregate because the problem is way upstream of the computation segment that actually ‘found’ the problem.

Gene Maguin

 

From: Timothy Hennigar [mailto:[hidden email]]
Sent: Thursday, August 11, 2016 10:26 AM
To: Maguin, Eugene <[hidden email]>
Subject: RE: Fun with SPSS - but having an issue

 

Ok – to finish this off ..

 

I decided to look further into this by creating a new string variable ..

I used A3  - and first took positions 1-3 – this only gave me 2 characters of the existing string – suggesting a blank in pos 1

So I then moved to create the new variable for pos 2-4 in orig and my team data was replicated in the new var ..

 

This suggested if I added a leading blank to my existing calcs it should work – but it still would not.

 

So I used my newly calc var and all is fine ..

 

What is going on with this I dont know and at this point I don’t care .. its working now on the new variable

 

 

Thanks!

*********************************

Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.

 

 

From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Maguin, Eugene
Sent: Wednesday, August 10, 2016 11:47 AM
To: [hidden email]
Subject: Re: Fun with SPSS - but having an issue

 

I understand your point about differences. I’m not sure that a trailing blank matters because when strings of different lengths are compared, the shorter strings are right padded with blanks to a common length. So, rather than blanks/spaces on the right, how about a space(s) on the left. Continuing with that idea, have you examined/compared the MLBTeam values going into the aggregate across files. Specifically, when you select a MLBTeam value and it appears in the data window edit line, does the character location match the character count and is that correspondence the same across both datasets?

Gene Maguin

 

 

From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Dr Chris Stride
Sent: Wednesday, August 10, 2016 11:29 AM
To: [hidden email]
Subject: Re: Fun with SPSS - but having an issue

 

Given lack of an error message in the output you sent me, the code itself is sound, so must be the data.

My best guess is that somehow in the second file your teams are not coded in the same way as in the first, i.e. they are not called exactly "BAL", "BOS" etc, (maybe they are not all in upper case, or there's a trailing blank?) so the 'if' statements are not picking them up, so no non-missing values are being created.

 

 

 

 

On 10/08/2016 16:07, Timothy Hennigar wrote:

No errors no warnings .. for my hitters it works fine but for pitchers it does not ..

 

The code wasn’t written to be parsimonious .. laff..   (I get the value of that at times .. but here

just getting out thoughts at the moment).

 

 

I’ll attached the output for the 2 little sections

Pass1 hitters

Pass2 pitchers

 

 

 

 

 

 

Thanks!

 

Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.

 

 

From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Dr Chris Stride
Sent: Wednesday, August 10, 2016 10:54 AM
To:
[hidden email]
Subject: Re: Fun with SPSS - but having an issue

 

Can't diagnose the issue without knowing if you have an error message and if so what it says - but the code could be a bit simpler by using a Do repeat loop of this form: (illustrated for 3 teams but could extend to all)

do repeat
 i = "BAL" "BOS" "CHW"
/j = 96 71 73
/k = 0.15 0.15 0.1 
/l =  0.1 0.15 0.1.
if Ovr_MLBT = i nOvr_scr = (1 + (j/162) + k + l).
end repeat.
exe.




On 10/08/2016 14:30, Maguin, Eugene wrote:

Two blocks of code with a difference in the computation, which I see. Unless there are some do ifs surrounding those blocks, the entire dataset should flow through the first block, creating the new variable and computing the value per the formula. The entire dataset should flow through the second block and replace the previously computed value with the newly computed value.

 

Is that what you are seeing? If not, define/illustrate in terms of example data the phrase “working in one place and not the other”

 

Gene Maguin

 

From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Timothy Hennigar
Sent: Wednesday, August 10, 2016 9:08 AM
To: [hidden email]
Subject: Fun with SPSS - but having an issue

 

Ok doing something for FUN and I am quite perplexed!!!!

 

I am using MLB data for a pool – trying to come up with some data summarization …

(methodologically sound or not .. lafff)

 

I am using what I think is EXACTLY (with a small calc. change) same code in 2 separate

locations in my program and its working in one place and not the other.

 

 

THIS WORKS

 

(here I just want to adjust the score I calculated for Hitters by the

record of the team he plays on, the division (unbalanced sched), ball park.)

 

FRE   Ovr_MLBT.

DESC  Ovr_scr

   / STATS=RANGE MIN MAX

.

**                                              RECORD    DIV    BP  .

IF (Ovr_MLBT ="BAL") nOvr_scr = Ovr_scr * (1 + ( 96/162) + 0.15 + 0.10 ).

IF (Ovr_MLBT ="BOS") nOvr_scr = Ovr_scr * (1 + ( 71/162) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="CHW") nOvr_scr = Ovr_scr * (1 + ( 73/162) + 0.10 + 0.10 ).

IF (Ovr_MLBT ="CLE") nOvr_scr = Ovr_scr * (1 + ( 85/162) + 0.10 + 0.10 ).

IF (Ovr_MLBT ="DET") nOvr_scr = Ovr_scr * (1 + ( 90/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="HOU") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="KC" ) nOvr_scr = Ovr_scr * (1 + ( 89/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="LAA") nOvr_scr = Ovr_scr * (1 + ( 98/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="MIN") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.10 + 0.05 ).

IF (Ovr_MLBT ="NYY") nOvr_scr = Ovr_scr * (1 + ( 84/162) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="OAK") nOvr_scr = Ovr_scr * (1 + ( 88/162) + 0.05 + 0.05 ).

IF (Ovr_MLBT ="SEA") nOvr_scr = Ovr_scr * (1 + ( 87/162) + 0.05 + 0.10 ).

IF (Ovr_MLBT ="TB" ) nOvr_scr = Ovr_scr * (1 + ( 77/163) + 0.15 + 0.15 ).

IF (Ovr_MLBT ="TEX") nOvr_scr = Ovr_scr * (1 + ( 67/163) + 0.05 + 0.05 ).

IF (Ovr_MLBT ="TOR") nOvr_scr = Ovr_scr * (1 + ( 83/162) + 0.15 + 0.15 ).

EXECUTE.

DESC  Ovr_scr nOvr_scr

   / STATS=RANGE MIN MAX

.

 

 

 

 

THIS DOES NOT WORK (the new varaiable is not created).

 

(doing same thing as above BUT for pitchers)

 

 

FRE Ovr_MLBT.

DESC  Ovr_scr

   / STATS=RANGE MIN MAX

.

EXECUTE.

IF (Ovr_MLBT ="BAL") nOvr_scr = Ovr_scr * (1 + ( 96/162) + 0.15 - 0.10 ).

IF (Ovr_MLBT ="BOS") nOvr_scr = Ovr_scr * (1 + ( 71/162) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="CHW") nOvr_scr = Ovr_scr * (1 + ( 73/162) + 0.10 - 0.10 ).

IF (Ovr_MLBT ="CLE") nOvr_scr = Ovr_scr * (1 + ( 85/162) + 0.10 - 0.10 ).

IF (Ovr_MLBT ="DET") nOvr_scr = Ovr_scr * (1 + ( 90/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="HOU") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="KC")  nOvr_scr = Ovr_scr * (1 + ( 89/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="LAA") nOvr_scr = Ovr_scr * (1 + ( 98/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="MIN") nOvr_scr = Ovr_scr * (1 + ( 70/162) + 0.10 - 0.05 ).

IF (Ovr_MLBT ="NYY") nOvr_scr = Ovr_scr * (1 + ( 84/162) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="OAK") nOvr_scr = Ovr_scr * (1 + ( 88/162) + 0.05 - 0.05 ).

IF (Ovr_MLBT ="SEA") nOvr_scr = Ovr_scr * (1 + ( 87/162) + 0.05 - 0.10 ).

IF (Ovr_MLBT ="TB")  nOvr_scr = Ovr_scr * (1 + ( 77/163) + 0.15 - 0.15 ).

IF (Ovr_MLBT ="TEX") nOvr_scr = Ovr_scr * (1 + ( 67/163) + 0.05 - 0.05 ).

IF (Ovr_MLBT ="TOR") nOvr_scr = Ovr_scr * (1 + ( 83/162) + 0.15 - 0.15 ).

EXECUTE.

DESC    Ovr_scr nOvr_scr

   / STATS=RANGE MIN MAX

.

 

 

 

 

 

 

 

Thanks!

 

*********************************

Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.

 

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

 

-- 
 
--
 
Dr Chris Stride, C. Stat, Statistician, Institute of Work Psychology,
University of Sheffield
Telephone: 0114 2223262
Fax: 0114 2727206
 
"Figure It Out"
Statistical Consultancy and Training Service for Social Scientists
 
Visit www.figureitout.org.uk for details of my consultancy services, and
forthcoming training courses, which are also available on an in-house basis:
 
 - Data management using SPSS syntax
 - Advanced SPSS syntax and SPSS macros
 - Testing for Mediation and Moderation using SPSS
 - Multi-level Modelling using SPSS
 - Introduction to Structural Equation Modelling using Mplus
 - Testing for Mediation and Moderation using Mplus
 - Multi-level Modelling using Mplus
 - Latent Growth Curve Modelling using Mplus 

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

 

-- 
 
--
 
Dr Chris Stride, C. Stat, Statistician, Institute of Work Psychology,
University of Sheffield
Telephone: 0114 2223262
Fax: 0114 2727206
 
"Figure It Out"
Statistical Consultancy and Training Service for Social Scientists
 
Visit www.figureitout.org.uk for details of my consultancy services, and
forthcoming training courses, which are also available on an in-house basis:
 
 - Data management using SPSS syntax
 - Advanced SPSS syntax and SPSS macros
 - Testing for Mediation and Moderation using SPSS
 - Multi-level Modelling using SPSS
 - Introduction to Structural Equation Modelling using Mplus
 - Testing for Mediation and Moderation using Mplus
 - Multi-level Modelling using Mplus
 - Latent Growth Curve Modelling using Mplus 

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