Restructuring data - cases to variables

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

Restructuring data - cases to variables

Mary E Mcgann

Hello,

I’m having challenge combining multiple rows for the same person into one row. The variables that identify a unique record are the ptID, dateOfservice, method, and procedure. Each ptID can have multiple dateOfservice, method and procedure.  The first date of service is the one that should guide, as it were, the order of the subsequent variables from the cases that follow.

I’m using the Restructure Data wizard and trying different combinations of identifier combinations and sometimes trying the index because nothing seems to be working correctly. I either end up with no restructuring or I get 80 different versions of dateOfservice variable.

I hope this makes sense.

Thanks in advance for your help!

Mary

 

===================== 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: Restructuring data - cases to variables

David Marso
Administrator
Please post a subset of the data as well as the desired outcome.



Mary E Mcgann wrote

> Hello,
> I'm having challenge combining multiple rows for the same person into one
> row. The variables that identify a unique record are the ptID,
> dateOfservice, method, and procedure. Each ptID can have multiple
> dateOfservice, method and procedure.  The first date of service is the one
> that should guide, as it were, the order of the subsequent variables from
> the cases that follow.
> I'm using the Restructure Data wizard and trying different combinations of
> identifier combinations and sometimes trying the index because nothing
> seems to be working correctly. I either end up with no restructuring or I
> get 80 different versions of dateOfservice variable.
> I hope this makes sense.
> Thanks in advance for your help!
> Mary
>
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Restructuring data - cases to variables

David Marso
Administrator
The following works fine with simple simdata.
  /AUTOFIX=NO is KEY here.

MATRIX.
SAVE TRUNC(UNIFORM(100000,4)*5)/OUTFILE=*.
END MATRIX.
COMPUTE ID=TRUNC(RV.UNIFORM(1,10000)).
SORT CASES BY ID COL1 TO COL4.
AGGREGATE OUTFILE * / BREAK ID COL1 TO COL4 / COUNT=N.
FORMATS ID COL1 TO COL4 (F5.0).


SORT CASES BY ID COL1 TO COL4 .
CASESTOVARS
  /ID=ID
  /INDEX=COL1 TO COL4
  /AUTOFIX=NO
  /GROUPBY=INDEX.


David Marso wrote

> Please post a subset of the data as well as the desired outcome.
>
>
>
> Mary E Mcgann wrote
>> Hello,
>> I'm having challenge combining multiple rows for the same person into one
>> row. The variables that identify a unique record are the ptID,
>> dateOfservice, method, and procedure. Each ptID can have multiple
>> dateOfservice, method and procedure.  The first date of service is the
>> one
>> that should guide, as it were, the order of the subsequent variables from
>> the cases that follow.
>> I'm using the Restructure Data wizard and trying different combinations
>> of
>> identifier combinations and sometimes trying the index because nothing
>> seems to be working correctly. I either end up with no restructuring or I
>> get 80 different versions of dateOfservice variable.
>> I hope this makes sense.
>> Thanks in advance for your help!
>> Mary
>>
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>
>> LISTSERV@.UGA
>
>>  (not to SPSSX-L), with no body text except the
>> command. To leave the list, send the command
>> SIGNOFF SPSSX-L
>> For a list of commands to manage subscriptions, send the command
>> INFO REFCARD
>
>
>
>
>
> -----
> Please reply to the list and not to my personal email.
> Those desiring my consulting or training services please feel free to
> email me.
> ---
> "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos
> ne forte conculcent eas pedibus suis."
> Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in
> abyssum?"
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"