Incorrect sequence of variables resulting from CASESTOVARS

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

Incorrect sequence of variables resulting from CASESTOVARS

Bailer Harald-2

Dear list,

 

I hope some of you can enlighten my understanding for behaviours of SPSS. I’m still using the Neolithic version 11 but hope that this is not an issue of this specific version no longer supported.

 

I have data, e.g. for the year 2009, of patients who responded to a questionnaire at the beginning of their treatment and at discharge. Some of them were admitted twice in the year. Data were stored in Excel, one row per questionnaire. I managed the import from Excel and face a data structure in which one row represents one given questionnaire, i.e. data for a specific patient (variable: name) may be found in up to four rows: one or two admittances in 2009 (variable: fall09; values 1 or 2) by measure at begin or end of treatment (variable: mzp; values 1 or 2). Other variables are date of measurement (messdat), age (alter), sex, questionnaire items (i01 to i38), and seven scores derived from these items (koe, psy, soz, kom, zuf, sou, ges).

 

For pairwise comparisons with t-test (scores admittance vs. discharge) I need to change from long to wide format using CASESTOVARS. Only the seven scores are of further interest, therefore I drop the other variables.

 

SORT CASES BY name fall09 mzp .

CASESTOVARS

 /ID = name fall09

 /INDEX = mzp

 /GROUPBY = INDEX

 /drop = messdat alter sex i01 to i38.

 

My expectation was that the sequence of the variables in wide format should be:  

koe.1 psy.1 soz.1 kom.1 zuf.1 sou.1 ges.1

koe.2 psy.2 soz.2 kom.2 zuf.2 sou.2 ges.2

 

Therefore I used the syntax

T-TEST

  PAIRS= koe.1 to ges.1 WITH koe.2 to ges.2 (PAIRED)

  /CRITERIA=CIN(.95)

  /MISSING=ANALYSIS.

and was confronted with the fact that the t-test for one variable (sou) was missing.

The point I do not understand: Why is the expected sequence not maintained? The new variables result in this order (last two changed positions):

koe.1 psy.1 soz.1 kom.1 zuf.1 ges.1 sou.1

koe.2 psy.2 soz.2 kom.2 zuf.2 ges.2 sou.2

 

Am I missing a specific point in the syntax? Or are the data corrupt? Any other ideas?

 

Thanks!

 

 

Dipl.-Psych. Dr. Harald Bailer

 

Reply | Threaded
Open this post in threaded view
|

Automatic reply: Incorrect sequence of variables resulting from CASESTOVARS

Ling Ting

I am out of office and will return on Friday April 15.  I will have very limited access to email. If you need immediate assistance please contact 479-575-2905.  Thank you..

Reply | Threaded
Open this post in threaded view
|

Re: Incorrect sequence of variables resulting from CASESTOVARS

Maguin, Eugene
In reply to this post by Bailer Harald-2
Harald,

I don't think your casestovars syntax is correct. A person can have up to
four rows: fall09=1 or 2 and mzp=1 or 2. You declare name and fall09 to be
the id variables. The possible outcomes are

1: 4 input rows
name fall09 koe.1 to ges1 koe.2 to ges2
Gene  1      5         3    2        8
Gene  2      4         2    6        4

2: 3 input rows (one example, other combinations exist.)
Gene  1      5         3    2        8
Gene  2      4         2    .        .

3: 2 input rows (one example, other combinations exist.)
Gene  1      5         3    .        .
Gene  2      .         .    6        4

4: 1 input row (one example, other combinations exist.)
Gene  2      5         3    .        .


I'm not sure, of course, but I'd guess that none of these results are
satisfactory. I'd guess that outcome 1) is not acceptable at all because the
same person is in the file twice. As I understand your data structure (and I
may be quite wrong) a person can have two pretests and two posttests.
Apparently some people do and some don't. As the investigator, you'll have
to decide what to do with people who have two pretests or two posttest; what
to do with people who have pretest1(fall09=1) and not pretest2(fall09=2) or
vice-versa; and the same for posttest1 and posttest2.

Gene Maguin






I have data, e.g. for the year 2009, of patients who responded to a
questionnaire at the beginning of their treatment and at discharge. Some of
them were admitted twice in the year. Data were stored in Excel, one row per
questionnaire. I managed the import from Excel and face a data structure in
which one row represents one given questionnaire, i.e. data for a specific
patient (variable: name) may be found in up to four rows: one or two
admittances in 2009 (variable: fall09; values 1 or 2) by measure at begin or
end of treatment (variable: mzp; values 1 or 2). Other variables are date of
measurement (messdat), age (alter), sex, questionnaire items (i01 to i38),
and seven scores derived from these items (koe, psy, soz, kom, zuf, sou,
ges).



For pairwise comparisons with t-test (scores admittance vs. discharge) I
need to change from long to wide format using CASESTOVARS. Only the seven
scores are of further interest, therefore I drop the other variables.



SORT CASES BY name fall09 mzp .

CASESTOVARS

 /ID = name fall09

 /INDEX = mzp

 /GROUPBY = INDEX

 /drop = messdat alter sex i01 to i38.



My expectation was that the sequence of the variables in wide format should
be:

koe.1 psy.1 soz.1 kom.1 zuf.1 sou.1 ges.1

koe.2 psy.2 soz.2 kom.2 zuf.2 sou.2 ges.2



Therefore I used the syntax

T-TEST

  PAIRS= koe.1 to ges.1 WITH koe.2 to ges.2 (PAIRED)

  /CRITERIA=CIN(.95)

  /MISSING=ANALYSIS.

and was confronted with the fact that the t-test for one variable (sou) was
missing.

The point I do not understand: Why is the expected sequence not maintained?
The new variables result in this order (last two changed positions):

koe.1 psy.1 soz.1 kom.1 zuf.1 ges.1 sou.1

koe.2 psy.2 soz.2 kom.2 zuf.2 ges.2 sou.2



Am I missing a specific point in the syntax? Or are the data corrupt? Any
other ideas?



Thanks!





Dipl.-Psych. Dr. Harald Bailer

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

AW: Incorrect sequence of variables resulting from CASESTOVARS

Bailer Harald-2
Gene,
thanks for your input. I'm aware of these pitfalls with missing values and multiple rows in the input file. The syntax is correct in so far that it gives me the pre- and posttest scores for one person at fall09 = 1 or 2 in one row. i.e. the transformed matrix contains two rows for one person if this person gave answers during both admittances irrespective of the fact if both, pre- and post questionnaires were returned.
Having the same person twice in the file for first and second admittance (allowing for two, three or four input rows) could easily be handled by excluding the cases with fall09 = 2. Then your scenarios 3 and 4 remain. Most of the persons filled in the questionnaires at both times = pre and post (the combination you didn't show in scenario 3).
But besides these manageable problems of missing values the questions remains: why does the sequence of variables not correspond to the input sequence?

The input matrix:
name fall09 mzp    koe to sou ges1
Gene  1      1      5       6  3
Gene  1      2      4       7  2

after CasesToVars should transform to (my expectation) this output matrix (mzp defines the index for the new var-names):

name fall09 koe.1 to sou.1 ges.1 koe.2 to sou.2 ges.2
Gene  1      5       6      3      4       7     2

But in fact result is:
name fall09 koe.1 to ges.1 sou.1 koe.2 to ges.2 sou.2
Gene  1      5        3      6     4        2    7

This interchange of variables confuses me.

Greetings from Germany
Harald


-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Gene Maguin
Gesendet: Donnerstag, 14. April 2011 15:32
An: [hidden email]
Betreff: Re: Incorrect sequence of variables resulting from CASESTOVARS

Harald,

I don't think your casestovars syntax is correct. A person can have up to
four rows: fall09=1 or 2 and mzp=1 or 2. You declare name and fall09 to be
the id variables. The possible outcomes are

1: 4 input rows
name fall09 koe.1 to ges1 koe.2 to ges2

2: 3 input rows (one example, other combinations exist.)
Gene  1      5         3    2        8
Gene  2      4         2    .        .

3: 2 input rows (one example, other combinations exist.)
Gene  1      5         3    .        .
Gene  2      .         .    6        4

4: 1 input row (one example, other combinations exist.)
Gene  2      5         3    .        .


I'm not sure, of course, but I'd guess that none of these results are
satisfactory. I'd guess that outcome 1) is not acceptable at all because the
same person is in the file twice. As I understand your data structure (and I
may be quite wrong) a person can have two pretests and two posttests.
Apparently some people do and some don't. As the investigator, you'll have
to decide what to do with people who have two pretests or two posttest; what
to do with people who have pretest1(fall09=1) and not pretest2(fall09=2) or
vice-versa; and the same for posttest1 and posttest2.

Gene Maguin






I have data, e.g. for the year 2009, of patients who responded to a
questionnaire at the beginning of their treatment and at discharge. Some of
them were admitted twice in the year. Data were stored in Excel, one row per
questionnaire. I managed the import from Excel and face a data structure in
which one row represents one given questionnaire, i.e. data for a specific
patient (variable: name) may be found in up to four rows: one or two
admittances in 2009 (variable: fall09; values 1 or 2) by measure at begin or
end of treatment (variable: mzp; values 1 or 2). Other variables are date of
measurement (messdat), age (alter), sex, questionnaire items (i01 to i38),
and seven scores derived from these items (koe, psy, soz, kom, zuf, sou,
ges).



For pairwise comparisons with t-test (scores admittance vs. discharge) I
need to change from long to wide format using CASESTOVARS. Only the seven
scores are of further interest, therefore I drop the other variables.



SORT CASES BY name fall09 mzp .

CASESTOVARS

 /ID = name fall09

 /INDEX = mzp

 /GROUPBY = INDEX

 /drop = messdat alter sex i01 to i38.



My expectation was that the sequence of the variables in wide format should
be:

koe.1 psy.1 soz.1 kom.1 zuf.1 sou.1 ges.1

koe.2 psy.2 soz.2 kom.2 zuf.2 sou.2 ges.2



Therefore I used the syntax

T-TEST

  PAIRS= koe.1 to ges.1 WITH koe.2 to ges.2 (PAIRED)

  /CRITERIA=CIN(.95)

  /MISSING=ANALYSIS.

and was confronted with the fact that the t-test for one variable (sou) was
missing.

The point I do not understand: Why is the expected sequence not maintained?
The new variables result in this order (last two changed positions):

koe.1 psy.1 soz.1 kom.1 zuf.1 ges.1 sou.1

koe.2 psy.2 soz.2 kom.2 zuf.2 ges.2 sou.2



Am I missing a specific point in the syntax? Or are the data corrupt? Any
other ideas?



Thanks!





Dipl.-Psych. Dr. Harald Bailer

=====================
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: AW: Incorrect sequence of variables resulting from CASESTOVARS

Bruce Weaver
Administrator
Harald, can you provide a few rows of data (via DATA LIST, perhaps) that illustrates the problem?


Bailer Harald-2 wrote
Gene,
thanks for your input. I'm aware of these pitfalls with missing values and multiple rows in the input file. The syntax is correct in so far that it gives me the pre- and posttest scores for one person at fall09 = 1 or 2 in one row. i.e. the transformed matrix contains two rows for one person if this person gave answers during both admittances irrespective of the fact if both, pre- and post questionnaires were returned.
Having the same person twice in the file for first and second admittance (allowing for two, three or four input rows) could easily be handled by excluding the cases with fall09 = 2. Then your scenarios 3 and 4 remain. Most of the persons filled in the questionnaires at both times = pre and post (the combination you didn't show in scenario 3).
But besides these manageable problems of missing values the questions remains: why does the sequence of variables not correspond to the input sequence?

The input matrix:
name fall09 mzp    koe to sou ges1
Gene  1      1      5       6  3
Gene  1      2      4       7  2

after CasesToVars should transform to (my expectation) this output matrix (mzp defines the index for the new var-names):

name fall09 koe.1 to sou.1 ges.1 koe.2 to sou.2 ges.2
Gene  1      5       6      3      4       7     2

But in fact result is:
name fall09 koe.1 to ges.1 sou.1 koe.2 to ges.2 sou.2
Gene  1      5        3      6     4        2    7

This interchange of variables confuses me.

Greetings from Germany
Harald


-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Gene Maguin
Gesendet: Donnerstag, 14. April 2011 15:32
An: [hidden email]
Betreff: Re: Incorrect sequence of variables resulting from CASESTOVARS

Harald,

I don't think your casestovars syntax is correct. A person can have up to
four rows: fall09=1 or 2 and mzp=1 or 2. You declare name and fall09 to be
the id variables. The possible outcomes are

1: 4 input rows
name fall09 koe.1 to ges1 koe.2 to ges2

2: 3 input rows (one example, other combinations exist.)
Gene  1      5         3    2        8
Gene  2      4         2    .        .

3: 2 input rows (one example, other combinations exist.)
Gene  1      5         3    .        .
Gene  2      .         .    6        4

4: 1 input row (one example, other combinations exist.)
Gene  2      5         3    .        .


I'm not sure, of course, but I'd guess that none of these results are
satisfactory. I'd guess that outcome 1) is not acceptable at all because the
same person is in the file twice. As I understand your data structure (and I
may be quite wrong) a person can have two pretests and two posttests.
Apparently some people do and some don't. As the investigator, you'll have
to decide what to do with people who have two pretests or two posttest; what
to do with people who have pretest1(fall09=1) and not pretest2(fall09=2) or
vice-versa; and the same for posttest1 and posttest2.

Gene Maguin






I have data, e.g. for the year 2009, of patients who responded to a
questionnaire at the beginning of their treatment and at discharge. Some of
them were admitted twice in the year. Data were stored in Excel, one row per
questionnaire. I managed the import from Excel and face a data structure in
which one row represents one given questionnaire, i.e. data for a specific
patient (variable: name) may be found in up to four rows: one or two
admittances in 2009 (variable: fall09; values 1 or 2) by measure at begin or
end of treatment (variable: mzp; values 1 or 2). Other variables are date of
measurement (messdat), age (alter), sex, questionnaire items (i01 to i38),
and seven scores derived from these items (koe, psy, soz, kom, zuf, sou,
ges).



For pairwise comparisons with t-test (scores admittance vs. discharge) I
need to change from long to wide format using CASESTOVARS. Only the seven
scores are of further interest, therefore I drop the other variables.



SORT CASES BY name fall09 mzp .

CASESTOVARS

 /ID = name fall09

 /INDEX = mzp

 /GROUPBY = INDEX

 /drop = messdat alter sex i01 to i38.



My expectation was that the sequence of the variables in wide format should
be:

koe.1 psy.1 soz.1 kom.1 zuf.1 sou.1 ges.1

koe.2 psy.2 soz.2 kom.2 zuf.2 sou.2 ges.2



Therefore I used the syntax

T-TEST

  PAIRS= koe.1 to ges.1 WITH koe.2 to ges.2 (PAIRED)

  /CRITERIA=CIN(.95)

  /MISSING=ANALYSIS.

and was confronted with the fact that the t-test for one variable (sou) was
missing.

The point I do not understand: Why is the expected sequence not maintained?
The new variables result in this order (last two changed positions):

koe.1 psy.1 soz.1 kom.1 zuf.1 ges.1 sou.1

koe.2 psy.2 soz.2 kom.2 zuf.2 ges.2 sou.2



Am I missing a specific point in the syntax? Or are the data corrupt? Any
other ideas?



Thanks!





Dipl.-Psych. Dr. Harald Bailer

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

AW: AW: Incorrect sequence of variables resulting from CASESTOVARS

Bailer Harald-2
Bruce,
Thanks for your reply. I'll try that on Monday, now, I'm off-house for the next days without access to my pc and the data.
Greetings


-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Bruce Weaver
Gesendet: Donnerstag, 14. April 2011 17:05
An: [hidden email]
Betreff: Re: AW: Incorrect sequence of variables resulting from CASESTOVARS

Harald, can you provide a few rows of data (via DATA LIST, perhaps) that
illustrates the problem?



Bailer Harald-2 wrote:

>
> Gene,
> thanks for your input. I'm aware of these pitfalls with missing values and
> multiple rows in the input file. The syntax is correct in so far that it
> gives me the pre- and posttest scores for one person at fall09 = 1 or 2 in
> one row. i.e. the transformed matrix contains two rows for one person if
> this person gave answers during both admittances irrespective of the fact
> if both, pre- and post questionnaires were returned.
> Having the same person twice in the file for first and second admittance
> (allowing for two, three or four input rows) could easily be handled by
> excluding the cases with fall09 = 2. Then your scenarios 3 and 4 remain.
> Most of the persons filled in the questionnaires at both times = pre and
> post (the combination you didn't show in scenario 3).
> But besides these manageable problems of missing values the questions
> remains: why does the sequence of variables not correspond to the input
> sequence?
>
> The input matrix:
> name fall09 mzp    koe to sou ges1
> Gene  1      1      5       6  3
> Gene  1      2      4       7  2
>
> after CasesToVars should transform to (my expectation) this output matrix
> (mzp defines the index for the new var-names):
>
> name fall09 koe.1 to sou.1 ges.1 koe.2 to sou.2 ges.2
> Gene  1      5       6      3      4       7     2
>
> But in fact result is:
> name fall09 koe.1 to ges.1 sou.1 koe.2 to ges.2 sou.2
> Gene  1      5        3      6     4        2    7
>
> This interchange of variables confuses me.
>
> Greetings from Germany
> Harald
>
>
> -----Ursprüngliche Nachricht-----
> Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von
> Gene Maguin
> Gesendet: Donnerstag, 14. April 2011 15:32
> An: [hidden email]
> Betreff: Re: Incorrect sequence of variables resulting from CASESTOVARS
>
> Harald,
>
> I don't think your casestovars syntax is correct. A person can have up to
> four rows: fall09=1 or 2 and mzp=1 or 2. You declare name and fall09 to be
> the id variables. The possible outcomes are
>
> 1: 4 input rows
> name fall09 koe.1 to ges1 koe.2 to ges2
>
> 2: 3 input rows (one example, other combinations exist.)
> Gene  1      5         3    2        8
> Gene  2      4         2    .        .
>
> 3: 2 input rows (one example, other combinations exist.)
> Gene  1      5         3    .        .
> Gene  2      .         .    6        4
>
> 4: 1 input row (one example, other combinations exist.)
> Gene  2      5         3    .        .
>
>
> I'm not sure, of course, but I'd guess that none of these results are
> satisfactory. I'd guess that outcome 1) is not acceptable at all because
> the
> same person is in the file twice. As I understand your data structure (and
> I
> may be quite wrong) a person can have two pretests and two posttests.
> Apparently some people do and some don't. As the investigator, you'll have
> to decide what to do with people who have two pretests or two posttest;
> what
> to do with people who have pretest1(fall09=1) and not pretest2(fall09=2)
> or
> vice-versa; and the same for posttest1 and posttest2.
>
> Gene Maguin
>
>
>
>
>
>
> I have data, e.g. for the year 2009, of patients who responded to a
> questionnaire at the beginning of their treatment and at discharge. Some
> of
> them were admitted twice in the year. Data were stored in Excel, one row
> per
> questionnaire. I managed the import from Excel and face a data structure
> in
> which one row represents one given questionnaire, i.e. data for a specific
> patient (variable: name) may be found in up to four rows: one or two
> admittances in 2009 (variable: fall09; values 1 or 2) by measure at begin
> or
> end of treatment (variable: mzp; values 1 or 2). Other variables are date
> of
> measurement (messdat), age (alter), sex, questionnaire items (i01 to i38),
> and seven scores derived from these items (koe, psy, soz, kom, zuf, sou,
> ges).
>
>
>
> For pairwise comparisons with t-test (scores admittance vs. discharge) I
> need to change from long to wide format using CASESTOVARS. Only the seven
> scores are of further interest, therefore I drop the other variables.
>
>
>
> SORT CASES BY name fall09 mzp .
>
> CASESTOVARS
>
>  /ID = name fall09
>
>  /INDEX = mzp
>
>  /GROUPBY = INDEX
>
>  /drop = messdat alter sex i01 to i38.
>
>
>
> My expectation was that the sequence of the variables in wide format
> should
> be:
>
> koe.1 psy.1 soz.1 kom.1 zuf.1 sou.1 ges.1
>
> koe.2 psy.2 soz.2 kom.2 zuf.2 sou.2 ges.2
>
>
>
> Therefore I used the syntax
>
> T-TEST
>
>   PAIRS= koe.1 to ges.1 WITH koe.2 to ges.2 (PAIRED)
>
>   /CRITERIA=CIN(.95)
>
>   /MISSING=ANALYSIS.
>
> and was confronted with the fact that the t-test for one variable (sou)
> was
> missing.
>
> The point I do not understand: Why is the expected sequence not
> maintained?
> The new variables result in this order (last two changed positions):
>
> koe.1 psy.1 soz.1 kom.1 zuf.1 ges.1 sou.1
>
> koe.2 psy.2 soz.2 kom.2 zuf.2 ges.2 sou.2
>
>
>
> Am I missing a specific point in the syntax? Or are the data corrupt? Any
> other ideas?
>
>
>
> Thanks!
>
>
>
>
>
> Dipl.-Psych. Dr. Harald Bailer
>
> =====================
> 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
>


-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Incorrect-sequence-of-variables-resulting-from-CASESTOVARS-tp4302704p4303265.html
Sent from the SPSSX Discussion mailing list archive at 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: Incorrect sequence of variables resulting from CASESTOVARS

Maguin, Eugene
In reply to this post by Bailer Harald-2
Harald,

I'm sorry, I didn't understand what you were saying. The problem is that the
variable order going into the casestovars is koe to sou ges. Coming out of
casestovars, the order is koe.1 to ges.1 sou.1 koe.2 to ges.2 sou.2. In
short, the variable output order does not correspond to the variable input
order.

Gene Maguin




-----Original Message-----
From: Bailer Harald [mailto:[hidden email]]
Sent: Thursday, April 14, 2011 10:12 AM
To: Gene Maguin; [hidden email]
Subject: AW: Incorrect sequence of variables resulting from CASESTOVARS

Gene,
thanks for your input. I'm aware of these pitfalls with missing values and
multiple rows in the input file. The syntax is correct in so far that it
gives me the pre- and posttest scores for one person at fall09 = 1 or 2 in
one row. i.e. the transformed matrix contains two rows for one person if
this person gave answers during both admittances irrespective of the fact if
both, pre- and post questionnaires were returned.
Having the same person twice in the file for first and second admittance
(allowing for two, three or four input rows) could easily be handled by
excluding the cases with fall09 = 2. Then your scenarios 3 and 4 remain.
Most of the persons filled in the questionnaires at both times = pre and
post (the combination you didn't show in scenario 3).
But besides these manageable problems of missing values the questions
remains: why does the sequence of variables not correspond to the input
sequence?

The input matrix:
name fall09 mzp    koe to sou ges1
Gene  1      1      5       6  3
Gene  1      2      4       7  2

after CasesToVars should transform to (my expectation) this output matrix
(mzp defines the index for the new var-names):

name fall09 koe.1 to sou.1 ges.1 koe.2 to sou.2 ges.2
Gene  1      5       6      3      4       7     2

But in fact result is:
name fall09 koe.1 to ges.1 sou.1 koe.2 to ges.2 sou.2
Gene  1      5        3      6     4        2    7

This interchange of variables confuses me.

Greetings from Germany
Harald


-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von
Gene Maguin
Gesendet: Donnerstag, 14. April 2011 15:32
An: [hidden email]
Betreff: Re: Incorrect sequence of variables resulting from CASESTOVARS

Harald,

I don't think your casestovars syntax is correct. A person can have up to
four rows: fall09=1 or 2 and mzp=1 or 2. You declare name and fall09 to be
the id variables. The possible outcomes are

1: 4 input rows
name fall09 koe.1 to ges1 koe.2 to ges2

2: 3 input rows (one example, other combinations exist.)
Gene  1      5         3    2        8
Gene  2      4         2    .        .

3: 2 input rows (one example, other combinations exist.)
Gene  1      5         3    .        .
Gene  2      .         .    6        4

4: 1 input row (one example, other combinations exist.)
Gene  2      5         3    .        .


I'm not sure, of course, but I'd guess that none of these results are
satisfactory. I'd guess that outcome 1) is not acceptable at all because the
same person is in the file twice. As I understand your data structure (and I
may be quite wrong) a person can have two pretests and two posttests.
Apparently some people do and some don't. As the investigator, you'll have
to decide what to do with people who have two pretests or two posttest; what
to do with people who have pretest1(fall09=1) and not pretest2(fall09=2) or
vice-versa; and the same for posttest1 and posttest2.

Gene Maguin






I have data, e.g. for the year 2009, of patients who responded to a
questionnaire at the beginning of their treatment and at discharge. Some of
them were admitted twice in the year. Data were stored in Excel, one row per
questionnaire. I managed the import from Excel and face a data structure in
which one row represents one given questionnaire, i.e. data for a specific
patient (variable: name) may be found in up to four rows: one or two
admittances in 2009 (variable: fall09; values 1 or 2) by measure at begin or
end of treatment (variable: mzp; values 1 or 2). Other variables are date of
measurement (messdat), age (alter), sex, questionnaire items (i01 to i38),
and seven scores derived from these items (koe, psy, soz, kom, zuf, sou,
ges).



For pairwise comparisons with t-test (scores admittance vs. discharge) I
need to change from long to wide format using CASESTOVARS. Only the seven
scores are of further interest, therefore I drop the other variables.



SORT CASES BY name fall09 mzp .

CASESTOVARS

 /ID = name fall09

 /INDEX = mzp

 /GROUPBY = INDEX

 /drop = messdat alter sex i01 to i38.



My expectation was that the sequence of the variables in wide format should
be:

koe.1 psy.1 soz.1 kom.1 zuf.1 sou.1 ges.1

koe.2 psy.2 soz.2 kom.2 zuf.2 sou.2 ges.2



Therefore I used the syntax

T-TEST

  PAIRS= koe.1 to ges.1 WITH koe.2 to ges.2 (PAIRED)

  /CRITERIA=CIN(.95)

  /MISSING=ANALYSIS.

and was confronted with the fact that the t-test for one variable (sou) was
missing.

The point I do not understand: Why is the expected sequence not maintained?
The new variables result in this order (last two changed positions):

koe.1 psy.1 soz.1 kom.1 zuf.1 ges.1 sou.1

koe.2 psy.2 soz.2 kom.2 zuf.2 ges.2 sou.2



Am I missing a specific point in the syntax? Or are the data corrupt? Any
other ideas?



Thanks!





Dipl.-Psych. Dr. Harald Bailer

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

AW: Incorrect sequence of variables resulting from CASESTOVARS

Bailer Harald-2
Gene,
you hit the point! Exact that is my problem. Sorry for having been so complicated.

Bruce,
below some example data are provided.

Using SPSS 11.0.1 I have the problem that Gene condensed to a clear statement. I can reproduce it with the example data and procedures shown below on my pc (XP SP3). For further clarification I ran these lines on PASW 18 (without patches), and the order of output variables were as expected.

So, it seems to be a problem of my ten years old SPSS 11.

Thank you for your input. This is a great list and community.

Happy Holidays
Harald



* maybe "," (German decimal delimiter) must be replaced by "." .

Data list
 free (TAB)
 /name (A1) messdat (Edate10) mzp fall09 (2F1.0) koe psy soz kom zuf sou ges (7F8.2).
Begin data.
C       15.05.2009      1       1       3,60    3,86    3,67    2,60    3,50    1,33    3,44
C       03.06.2009      2       1       2,20    2,79    2,89    2,80    3,00    1,67    2,73
A       18.06.2009      1       1       1,40    2,57    1,22    2,60    4,00    1,00    2,36
D       14.07.2009      2       1       2,00    2,71    3,11    2,80    3,00    3,00    2,73
A       21.07.2009      2       1       1,00    2,14    2,00    2,80    3,00    1,00    2,19
B       21.08.2009      1       1       3,00    3,57    3,67    3,80    ,       2,33    ,
C       24.09.2009      1       2       2,40    2,64    2,44    2,60    2,00    2,33    2,42
B       25.09.2009      2       1       2,00    ,       2,67    3,00    ,       2,33    ,
C       15.10.2009      2       2       1,40    1,71    1,56    2,00    2,00    2,00    1,73
End data.

var label messdat 'date of event' /
 mzp '#of measure for admittance' /
 fall09 '# of admittance during 2009'.
val labels fall09 1 'first admittance'
 2 'second admittance'.
val labels mzp 1 'pre' 2 'post'.


SORT CASES BY name fall09 mzp .

CASESTOVARS
 /ID = name fall09
 /INDEX = mzp
 /GROUPBY = INDEX
 /drop = messdat.


-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Gene Maguin
Gesendet: Donnerstag, 14. April 2011 19:49
An: [hidden email]
Betreff: Re: Incorrect sequence of variables resulting from CASESTOVARS

Harald,

I'm sorry, I didn't understand what you were saying. The problem is that the
variable order going into the casestovars is koe to sou ges. Coming out of
casestovars, the order is koe.1 to ges.1 sou.1 koe.2 to ges.2 sou.2. In
short, the variable output order does not correspond to the variable input
order.

Gene Maguin

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD