Recoding problem

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

Recoding problem

Hermann
Hi folks,

just a simple recoding procedure as painted out in the following syntax
(testsyntax.sps) is applied to the data in testdata.sav. The syntax is
pasted from the syntax window as it pastes the command „DATASET ACTIVATE"
too.


* Encoding: windows-1252.
DATASET NAME FB_RAW WINDOW=FRONT.
DATASET ACTIVATE FB_RAW WINDOW=FRONT.
* recoding substance.
NUMERIC Substance_rec (F1.0).
* This command at this position is pasted from the syntax window but causes
an error in recoding.
DATASET ACTIVATE FB_RAW.
RECODE Substance (1,2=1) (3,4=2) INTO Substance_rec.
EXECUTE.


When using the command „DATASET ACTIVATE FB_RAW“ the recoding is working
wrong. Expecting the categories mentioned in recode (1, 2 & 3, 4) will be
recoded and the one not mentioned (0) will remain unchanged. But the one
category not mentioned (0) is recoded into 2 as well. Why?
When deactivating „DATASET ACTIVATE“ the entire procedure is working well.

For demonstrating the effect the data is reduced from hundreds of cases and
a lot of variables.

Any idea what‘s going wrong here is welcome,
ATB, Hermann

testdata.sav
<http://spssx-discussion.1045642.n5.nabble.com/file/t327237/testdata.sav>  
testsyntax.sps
<http://spssx-discussion.1045642.n5.nabble.com/file/t327237/testsyntax.sps>  




-----
Mag. Dr. Hermann Stefan Cesnik
Zentraler Informatikdienst (Empirische Forschungsmethoden)
Language Testing Centre (LTC)
Alpen-Adria Universität Klagenfurt
 
phone:  +43 (0)463 2700-2533
mail: hermann.cesnik [at] uni-klu.ac.at
web: https://campus.aau.at/visitenkarte?username=hcesnik
        https://www.aau.at/en/language-testing-centre/team/
        https://www.researchgate.net/profile/Hermann_Cesnik
--
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
Mag. Dr. Hermann Stefan Cesnik
Zentraler Informatikdienst (Empirische Forschungsmethoden)
Language Testing Centre (LTC)
Alpen-Adria Universität Klagenfurt
 
phone:  +43 (0)463 2700-2533
mail: hermann.cesnik [at] uni-klu.ac.at
web: https://campus.aau.at/visitenkarte?username=hcesnik
        https://www.aau.at/en/language-testing-centre/team/
        https://www.researchgate.net/profile/Hermann_Cesnik
Reply | Threaded
Open this post in threaded view
|

Re: Recoding problem

Kirill Orlov
You must include data example to demonstrate the problem.

=====================
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: Recoding problem

Kirill Orlov
In reply to this post by Hermann
Indeed, I see there is a strange behaviour....

19.12.2019 10:56, Hermann пишет:

> Hi folks,
>
> just a simple recoding procedure as painted out in the following syntax
> (testsyntax.sps) is applied to the data in testdata.sav. The syntax is
> pasted from the syntax window as it pastes the command „DATASET ACTIVATE"
> too.
>
>
> * Encoding: windows-1252.
> DATASET NAME FB_RAW WINDOW=FRONT.
> DATASET ACTIVATE FB_RAW WINDOW=FRONT.
> * recoding substance.
> NUMERIC Substance_rec (F1.0).
> * This command at this position is pasted from the syntax window but causes
> an error in recoding.
> DATASET ACTIVATE FB_RAW.
> RECODE Substance (1,2=1) (3,4=2) INTO Substance_rec.
> EXECUTE.
>
>
> When using the command „DATASET ACTIVATE FB_RAW“ the recoding is working
> wrong. Expecting the categories mentioned in recode (1, 2 & 3, 4) will be
> recoded and the one not mentioned (0) will remain unchanged. But the one
> category not mentioned (0) is recoded into 2 as well. Why?
> When deactivating „DATASET ACTIVATE“ the entire procedure is working well.
>
> For demonstrating the effect the data is reduced from hundreds of cases and
> a lot of variables.
>
> Any idea what‘s going wrong here is welcome,
> ATB, Hermann
>
> testdata.sav
> <http://spssx-discussion.1045642.n5.nabble.com/file/t327237/testdata.sav>
> testsyntax.sps
> <http://spssx-discussion.1045642.n5.nabble.com/file/t327237/testsyntax.sps>
>
>
>
>
> -----
> Mag. Dr. Hermann Stefan Cesnik
> Zentraler Informatikdienst (Empirische Forschungsmethoden)
> Language Testing Centre (LTC)
> Alpen-Adria Universität Klagenfurt
>  
> phone:  +43 (0)463 2700-2533
> mail: hermann.cesnik [at] uni-klu.ac.at
> web: https://campus.aau.at/visitenkarte?username=hcesnik
>          https://www.aau.at/en/language-testing-centre/team/
>          https://www.researchgate.net/profile/Hermann_Cesnik
> --
> 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: Recoding problem

Kirill Orlov
In reply to this post by Hermann
The unusual point is located here:

DATASET NAME FB_RAW WINDOW=FRONT.
DATASET ACTIVATE FB_RAW WINDOW=FRONT.
NUMERIC Substance_rec3 (F1.0).
DATASET ACTIVATE FB_RAW.
EXECUTE.

with both last 2 commands present, Substance_rec3 appears as initialized
with zeros, not as system missing.
This should be annoying, even though DATASET ACTIVATE FB_RAW is a
needless command here.

I'm inclined to consider this as a bug.

=====================
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: Recoding problem

Kirill Orlov
In reply to this post by Hermann
This is indeed bizzare.

With you data,
I run:
DATASET ACTIVATE FB_RAW.
NUMERIC Substance_rec3 (F1.0).
DATASET ACTIVATE FB_RAW.
EXECUTE.

Substance_rec3 is sysmis.

Then delete the Substance_rec3 manually and rerun same syntax:
DATASET ACTIVATE FB_RAW.
NUMERIC Substance_rec3 (F1.0).
DATASET ACTIVATE FB_RAW.
EXECUTE.

This time Substance_rec3 is zero.

?????

=====================
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: Recoding problem

Jon Peck
I think Kirill is right that this is a bug in the interaction of DATASET ACTIVATE and NUMERIC.  NUMERIC is executed out of order, as documented, but I suspect that the cause is this, from the NUMERIC doc.
"Permanent or temporary variables are initialized to the system-missing value. Scratch variables are
initialized to 0."

An EXECUTE or other data-passing command after NUMERIC produces the correct result.

I have reported this to Development.


On Thu, Dec 19, 2019 at 1:58 AM Kirill Orlov <[hidden email]> wrote:
This is indeed bizzare.

With you data,
I run:
DATASET ACTIVATE FB_RAW.
NUMERIC Substance_rec3 (F1.0).
DATASET ACTIVATE FB_RAW.
EXECUTE.

Substance_rec3 is sysmis.

Then delete the Substance_rec3 manually and rerun same syntax:
DATASET ACTIVATE FB_RAW.
NUMERIC Substance_rec3 (F1.0).
DATASET ACTIVATE FB_RAW.
EXECUTE.

This time Substance_rec3 is zero.

?????

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


--
Jon K Peck
[hidden email]

===================== 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: Recoding problem

Hermann
Thanks for adopting and reporting this error to the SPSS Development.

Did read the command syntax reference carefully. The manual says: "NUMERIC
takes effect as soon as it is encountered in the command sequence." That
means from my point of view no EXE should be neccessary for NUMERIC as I'm
applying this for dozens of years.

Sure, the DATASET ACTIVATE after NUMERIC is over-determined because no
change of dataset happens after NUMERIC. Exactly this caused the error I
reported.

ATB, Hermann




-----
Mag. Dr. Hermann Stefan Cesnik
Zentraler Informatikdienst (Empirische Forschungsmethoden)
Language Testing Centre (LTC)
Alpen-Adria Universität Klagenfurt
 
phone:  +43 (0)463 2700-2533
mail: hermann.cesnik [at] uni-klu.ac.at
web: https://campus.aau.at/visitenkarte?username=hcesnik
        https://www.aau.at/en/language-testing-centre/team/
        https://www.researchgate.net/profile/Hermann_Cesnik
--
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
Mag. Dr. Hermann Stefan Cesnik
Zentraler Informatikdienst (Empirische Forschungsmethoden)
Language Testing Centre (LTC)
Alpen-Adria Universität Klagenfurt
 
phone:  +43 (0)463 2700-2533
mail: hermann.cesnik [at] uni-klu.ac.at
web: https://campus.aau.at/visitenkarte?username=hcesnik
        https://www.aau.at/en/language-testing-centre/team/
        https://www.researchgate.net/profile/Hermann_Cesnik
Reply | Threaded
Open this post in threaded view
|

Re: Recoding problem

Jon Peck
The NUMERIC and STRING commands are unique in Statistics as far as I can recall in that they both define variables and add them to the dictionary and specify the values without requiring a data pass.  So they are sort of transformations and sort of not.  However, switching the active dataset (even if it is actually the same dataset) requires that any pending transformations be carried out first.  This happens automatically, but apparently that code does not handle these unique commands correctly.  I suspect that this bug did not surface earlier because usually a NUMERIC or STRING command would be followed immediately by a COMPUTE or similar that set the values completely.

So it is clear how to work around the problem, but I hope this misbehavior gets fixed in the next release or fixpack.

On Fri, Dec 20, 2019 at 12:25 AM Hermann <[hidden email]> wrote:
Thanks for adopting and reporting this error to the SPSS Development.

Did read the command syntax reference carefully. The manual says: "NUMERIC
takes effect as soon as it is encountered in the command sequence." That
means from my point of view no EXE should be neccessary for NUMERIC as I'm
applying this for dozens of years.

Sure, the DATASET ACTIVATE after NUMERIC is over-determined because no
change of dataset happens after NUMERIC. Exactly this caused the error I
reported.

ATB, Hermann




-----
Mag. Dr. Hermann Stefan Cesnik
Zentraler Informatikdienst (Empirische Forschungsmethoden)
Language Testing Centre (LTC)
Alpen-Adria Universität Klagenfurt

phone:  +43 (0)463 2700-2533
mail: hermann.cesnik [at] uni-klu.ac.at
web: https://campus.aau.at/visitenkarte?username=hcesnik
        https://www.aau.at/en/language-testing-centre/team/
        https://www.researchgate.net/profile/Hermann_Cesnik
--
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


--
Jon K Peck
[hidden email]

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