CasesToVars adding new variables (PASW v.17)

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

CasesToVars adding new variables (PASW v.17)

Karen Harker
I have a casesToVars syntax that is doing something I've never seen before.  The data set is sorted by subj_ID then session (which is a text field that has abbreviations for each session attended by the subject).  So the vertical structure is like this:
Subj_ID
Session
Date
Cotinine (a numeric value)
 
Each row has one subject-one session; I'm wanting to restructure to have one row per subject, and multiple columns for each set of sessions.  It should come out like this:
Subj_ID
Date_i ("i" for initial)
Cotinine_i
Date_f1 ("f1" for follow-up #1)
Cotinine_f1
...
 
Here's the syntax I use:
SORT CASES BY Subj_id Session.
CASESTOVARS
  /ID=subj_id
  /INDEX=Session
  /SEPARATOR = "_cot_"
  /GROUPBY=INDEX
  /AUTOFIX=No
  /COUNT=Total_sessions "Total number of sessions with data".
 
The Output returns this error:
CASES TO VARS created the name "Date_cot_i" for a new variable. That name is already in use, so "v1" will be used instead.
CASES TO VARS created the name "Cotinine_cot_i" for a new variable. That name is already in use, so "v2" will be used instead.
 
Also, the output of the Generated Variables appears to have 2 sets (emphasis added):
 Generated Variables
Name Date Date of sample
  f1 Follow-up 1 Date_cotinine_f1
  ... (other sessions)
  i Initial v1
  ...
 Cotinine Cotinine value in ng/mL
  f1 Follow-up 1 Cotinine_cotinine_f1
  ...
  i Initial v2
  ...
Label Date Date of sample
  f1 Follow-up 1 Date_cotinine_f1: Date of sample
  ...
  i Initial Date_cotinine_i: Date of sample
  ...
 Cotinine Cotinine value in ng/mL 
  f1 Follow-up 1 Cotinine_cotinine_f1: Cotinine value in ng/mL
  ...
  i Initial Cotinine_cotinine_i: Cotinine value in ng/mL
  ...
 
I cannot figure out why it is doing this.  I've checked the values of all of the Session variables and they appear to be correct.  There is no duplicate subj_ID-Session pair.  And this same syntax works fine with other data sets (most of our data sets have a similar structure for multiple sessions).
 
Any help would be appreciated.
 
 
 
 
Karen R. Harker, MLS, MPH
Biostatistical Consultant
Adolescent Mood and Addictive Disorders Research Program
UT Southwestern Medical Center
5323 Harry Hines Blvd.
Dallas, TX  75390-
214-648-5391
Yahoo IM: karenharker
Reply | Threaded
Open this post in threaded view
|

Re: CasesToVars adding new variables (PASW v.17)

Jerabek Jindrich
Karen,

it seems that var Session is not 100% correctly typed.

SPSS tries to create vars xxxx_i twice, i would suggest to check the var Session once more, especialy looking for "i" typed instead of "j" and then for "i" typed instead of anything else.

You might wont to aggregate data by subj_id and Session, save N of cases with the same Id and Session and if there is any with N>1 the problem is found.

HTH
Jindra


> ------------ Původní zpráva ------------
> Od: Karen Harker <[hidden email]>
> Předmět: CasesToVars adding new variables (PASW v.17)
> Datum: 19.1.2010 21:44:35
> ----------------------------------------
> I have a casesToVars syntax that is doing something I've never seen before.  The
> data set is sorted by subj_ID then session (which is a text field that has
> abbreviations for each session attended by the subject).  So the vertical
> structure is like this:
> Subj_ID
> Session
> Date
> Cotinine (a numeric value)
>
> Each row has one subject-one session; I'm wanting to restructure to have one row
> per subject, and multiple columns for each set of sessions.  It should come out
> like this:
> Subj_ID
> Date_i ("i" for initial)
> Cotinine_i
> Date_f1 ("f1" for follow-up #1)
> Cotinine_f1
> ...
>
> Here's the syntax I use:
> SORT CASES BY Subj_id Session.
> CASESTOVARS
>   /ID=subj_id
>   /INDEX=Session
>   /SEPARATOR = "_cot_"
>   /GROUPBY=INDEX
>   /AUTOFIX=No
>   /COUNT=Total_sessions "Total number of sessions with data".
>
> The Output returns this error:
> CASES TO VARS created the name "Date_cot_i" for a new variable. That name is
> already in use, so "v1" will be used instead.
> CASES TO VARS created the name "Cotinine_cot_i" for a new variable. That name is
> already in use, so "v2" will be used instead.
>
> Also, the output of the Generated Variables appears to have 2 sets (emphasis
> added):
>  Generated Variables
> Name Date Date of sample
>   f1 Follow-up 1 Date_cotinine_f1
>   ... (other sessions)
>   i Initial v1
>   ...
>  Cotinine Cotinine value in ng/mL
>   f1 Follow-up 1 Cotinine_cotinine_f1
>   ...
>   i Initial v2
>   ...
> Label Date Date of sample
>   f1 Follow-up 1 Date_cotinine_f1: Date of sample
>   ...
>   i Initial Date_cotinine_i: Date of sample
>   ...
>  Cotinine Cotinine value in ng/mL
>   f1 Follow-up 1 Cotinine_cotinine_f1: Cotinine value in ng/mL
>   ...
>   i Initial Cotinine_cotinine_i: Cotinine value in ng/mL
>   ...
>
> I cannot figure out why it is doing this.  I've checked the values of all of the
> Session variables and they appear to be correct.  There is no duplicate
> subj_ID-Session pair.  And this same syntax works fine with other data sets
> (most of our data sets have a similar structure for multiple sessions).
>
> Any help would be appreciated.
>
>
>
>
> Karen R. Harker, MLS, MPH
> Biostatistical Consultant
> Adolescent Mood and Addictive Disorders Research Program
> UT Southwestern Medical Center
> 5323 Harry Hines Blvd.
> Dallas, TX  75390-
> 214-648-5391
> Yahoo IM: karenharker
>
>
>

=====================
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: CasesToVars adding new variables (PASW v.17)

Karen Harker
Thanks for the suggestion, but I checked that, and even copied & pasted the same "i" into each record, to no avail.  I also did the aggregation, but all N's were = 1. 
 
I did aggregate on Session only just to check all the session values and there are 2 "i's" - one with 19 records and one with 61 (good clue, eh?).  But when I try to select cases where Session='i', I get 80 cases.  So I have no idea which are which and which ones to edit.  Like I said, I've copied and pasted
 
I finally just created a new Session field and manually typed in the values to start fresh.  THis solved the problem, although I still don't know the reason for the problem in the first place.
 
Again, thanks...sometimes it's just easier to start over.
 
Karen

>>> On 1/19/10 at 3:39 PM, in message <[hidden email]>, Jerabek Jindrich <[hidden email]> wrote:
Karen,

it seems that var Session is not 100% correctly typed.

SPSS tries to create vars xxxx_i twice, i would suggest to check the var Session once more, especialy looking for "i" typed instead of "j" and then for "i" typed instead of anything else.

You might wont to aggregate data by subj_id and Session, save N of cases with the same Id and Session and if there is any with N>1 the problem is found.

HTH
Jindra


> ------------ Původní zpráva ------------
> Od: Karen Harker <[hidden email]>
> Předmět: CasesToVars adding new variables (PASW v.17)
> Datum: 19.1.2010 21:44:35
> ----------------------------------------
> I have a casesToVars syntax that is doing something I've never seen before.  The
> data set is sorted by subj_ID then session (which is a text field that has
> abbreviations for each session attended by the subject).  So the vertical
> structure is like this:
> Subj_ID
> Session
> Date
> Cotinine (a numeric value)
>
> Each row has one subject-one session; I'm wanting to restructure to have one row
> per subject, and multiple columns for each set of sessions.  It should come out
> like this:
> Subj_ID
> Date_i ("i" for initial)
> Cotinine_i
> Date_f1 ("f1" for follow-up #1)
> Cotinine_f1
> ...
>
> Here's the syntax I use:
> SORT CASES BY Subj_id Session.
> CASESTOVARS
>   /ID=subj_id
>   /INDEX=Session
>   /SEPARATOR = "_cot_"
>   /GROUPBY=INDEX
>   /AUTOFIX=No
>   /COUNT=Total_sessions "Total number of sessions with data".
>
> The Output returns this error:
> CASES TO VARS created the name "Date_cot_i" for a new variable. That name is
> already in use, so "v1" will be used instead.
> CASES TO VARS created the name "Cotinine_cot_i" for a new variable. That name is
> already in use, so "v2" will be used instead.
>
> Also, the output of the Generated Variables appears to have 2 sets (emphasis
> added):
>  Generated Variables
> Name Date Date of sample
>   f1 Follow-up 1 Date_cotinine_f1
>   ... (other sessions)
>   i Initial v1
>   ...
>  Cotinine Cotinine value in ng/mL
>   f1 Follow-up 1 Cotinine_cotinine_f1
>   ...
>   i Initial v2
>   ...
> Label Date Date of sample
>   f1 Follow-up 1 Date_cotinine_f1: Date of sample
>   ...
>   i Initial Date_cotinine_i: Date of sample
>   ...
>  Cotinine Cotinine value in ng/mL
>   f1 Follow-up 1 Cotinine_cotinine_f1: Cotinine value in ng/mL
>   ...
>   i Initial Cotinine_cotinine_i: Cotinine value in ng/mL
>   ...
>
> I cannot figure out why it is doing this.  I've checked the values of all of the
> Session variables and they appear to be correct.  There is no duplicate
> subj_ID-Session pair.  And this same syntax works fine with other data sets
> (most of our data sets have a similar structure for multiple sessions).
>
> Any help would be appreciated.
>
>
>
>
> Karen R. Harker, MLS, MPH
> Biostatistical Consultant
> Adolescent Mood and Addictive Disorders Research Program
> UT Southwestern Medical Center
> 5323 Harry Hines Blvd.
> Dallas, TX  75390-
> 214-648-5391
> Yahoo IM: karenharker
>
>
>

=====================
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: CasesToVars adding new variables (PASW v.17)

Bruce Weaver
Administrator
Karen Harker wrote
Thanks for the suggestion, but I checked that, and even copied & pasted
the same "i" into each record, to no avail.  I also did the aggregation,
but all N's were = 1.  
 
I did aggregate on Session only just to check all the session values
and there are 2 "i's" - one with 19 records and one with 61 (good clue,
eh?).  But when I try to select cases where Session='i', I get 80 cases.
 So I have no idea which are which and which ones to edit.  Like I said,
I've copied and pasted
 
I finally just created a new Session field and manually typed in the
values to start fresh.  THis solved the problem, although I still don't
know the reason for the problem in the first place.
 
Again, thanks...sometimes it's just easier to start over.
 
Karen

>>> On 1/19/10 at 3:39 PM, in message
<126630.824.1146-8324-468108419-1263937156@seznam.cz>, Jerabek
Jindrich <JindraJerabek@seznam.cz> wrote:
Karen,
I suspect an AUTORECODE of your string variable would show that were variations that were not easy to spot (e.g., extra spaces here or there).

--
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/).