|
Hi all:
I have a data management question. I just cleaned an entire dataset for an experimental study involving mixed-sex dyads. The data are entered with one row for each participant with a variable indicating the couple they are part of. For example: subject # dyad # well-being rel sat 1 1 2 1 3 2 4 2 I want to examine the interaction of self and partner effects using dyadic analyses (Kenny). I know that I need to have each row set up such that the person and their partner's variables need to be in the same row (essentially this is the double-entry method). Is there a way to do this other than the incredibly resource intensive and error-prone method of copying and pasting the data from one row to the partners row? is there a syntax that can be created to do this? This is way out of my expertise with syntaxes and any advice would be incredibly appreciated. thanks so much gratefully, Todd ************************** Todd B. Kashdan, Ph.D. Assistant Professor Department of Psychology George Mason University Mail Stop 3F5 Fairfax, VA 22030 http://mason.gmu.edu/~tkashdan Confidentiality Notice: If you have reason to believe that you are not the intended recipient of this communication, please contact the sender immediately, and delete it from your system. Any unauthorized review, use, disclosure or distribution is prohibited. ____________________________________________________________________________________ Food fight? Enjoy some healthy debate in the Yahoo! Answers Food & Drink Q&A. http://answers.yahoo.com/dir/?link=list&sid=396545367 |
|
Todd,
I've only got a minute, actually less than that. You want to convert from 'long' to 'wide'. Read up on the Casestovars command. Gene Maguin |
|
In reply to this post by Todd Kashdan
At 05:09 PM 3/15/2007, Todd Kashdan wrote:
>I [have] an experimental study involving mixed-sex dyads. The data >are entered with one row for each participant with a variable >indicating the >couple they are part of. For example: > >subject # dyad # well-being rel sat >1 1 >2 1 >3 2 >4 2 > >I need to have each row set up such that the person and their >partner's variables need to be in the same row. Sure. It's quite simple CASESTOVARS syntax. I clicked this up from the Data Restructure wizard, accessed by Data> Restructure: Panel ----- 1. "Restructure selected cases into variables" 2. Identifier variable "Dyad#". NO index variables. 3. I'm not having it sorted; I sorted before doing this. I recommend that 4. "Group by index" - or, see if you like it better with "Group by original variable". Don't select anything else But it might be just as easy to write it. Anyway -- this is SPSS 15 draft output <WRR-not saved separately>: List |-----------------------------|---------------------------| |Output Created |15-MAR-2007 17:42:55 | |-----------------------------|---------------------------| Subject# Dyad# Well.Being Rel.Sat 1 1 Great Good 2 1 Excellent Medium 3 2 Fair Bad 4 2 Bad Awful Number of cases read: 4 Number of cases listed: 4 CASESTOVARS /ID = Dyad# /GROUPBY = INDEX . Cases to Variables |----------------------------|---------------------------| |Output Created |15-MAR-2007 17:55:21 | |----------------------------|---------------------------| Generated Variables |------------|------------| |Original |Result | |Variable |------------| | |Name | |----------|-|------------| |Subject# |1|Subject#.1 | | |2|Subject#.2 | |----------|-|------------| |Well.Being|1|Well.Being.1| | |2|Well.Being.2| |----------|-|------------| |Rel.Sat |1|Rel.Sat.1 | | |2|Rel.Sat.2 | |----------|-|------------| Processing Statistics |---------------|---| |Cases In |4 | |Cases Out |2 | |---------------|---| |Cases In/Cases |2.0| |Out | | |---------------|---| |Variables In |4 | |Variables Out |7 | |---------------|---| |Index Values |2 | |---------------|---| LIST. List |-----------------------------|---------------------------| |Output Created |15-MAR-2007 17:55:41 | |-----------------------------|---------------------------| Dyad# Subject#.1 Well.Being.1 Rel.Sat.1 Subject#.2 Well.Being.2 Rel.Sat.2 1 1 Great Good 2 Excellent Medium 2 3 Fair Bad 4 Bad Awful Number of cases read: 2 Number of cases listed: 2 =================== APPENDIX: Test data =================== DATA LIST LIST SKIP=1/ Subject# Dyad# (2F3) Well.Being Rel.Sat(2A10). BEGIN DATA subject # dyad # well-being rel sat 1 1 Great Good 2 1 Excellent Medium 3 2 Fair Bad 4 2 Bad Awful END DATA. LIST. |
|
Response to an off-list follow-up: at 02:10 PM 3/18/2007, Todd Kashdan
wrote, >Thanks Richard. But one last question that makes it a bit more >complex than a simple CASESTOVARS syntax. The final dataset should >have two rows for each dyad. In one row, the S data is listed first >and then their >partners data. But in another row, the partner is the S and the S >from the prior row's data should come next. Like this: > >subject dyad well-being partner well-being >1 1 4 5 >2 1 5 4 Amazing what you learn, isn't it? Could probably have solved this for you the first time, if you'd asked the first time. Just use CASESTOVARS, but use it twice. This requires that both the original data and the first 'wide' file be saved for re-use. The following uses SPSS 15 'dataset' logic, but scratch .SAV files would work fine. This is SPSS 15 draft output: * ................................................... . LIST. List |-----------------------------|---------------------------| |Output Created |19-MAR-2007 01:16:23 | |-----------------------------|---------------------------| Subject# Dyad# Well.Bng Rel.Sat 1 1 Great Good 2 1 Great Medium 3 2 Fair Bad 4 2 Bad Awful Number of cases read: 4 Number of cases listed: 4 . DATASET COPY InptData . *--SAVE OUTFILE=InptData . * ...... I. Pairs in forward order ...... . SORT CASES BY Dyad# (A) Subject#(A). CASESTOVARS /ID = Dyad# /GROUPBY = INDEX . Cases to Variables |----------------------------|---------------------------| |Output Created |19-MAR-2007 01:16:24 | |----------------------------|---------------------------| Generated Variables |----------|----------| |Original |Result | |Variable |----------| | |Name | |--------|-|----------| |Subject#|1|Subject#.1| | |2|Subject#.2| |--------|-|----------| |Well.Bng|1|Well.Bng.1| | |2|Well.Bng.2| |--------|-|----------| |Rel.Sat |1|Rel.Sat.1 | | |2|Rel.Sat.2 | |--------|-|----------| Processing Statistics |---------------|---| |Cases In |4 | |Cases Out |2 | |---------------|---| |Cases In/Cases |2.0| |Out | | |---------------|---| |Variables In |4 | |Variables Out |7 | |---------------|---| |Index Values |2 | |---------------|---| . /**/ LIST /*-*/. List |-----------------------------|---------------------------| |Output Created |19-MAR-2007 01:16:24 | |-----------------------------|---------------------------| Dyad# Subject#.1 Well.Bng.1 Rel.Sat.1 Subject#.2 Well.Bng.2 Rel.Sat.2 1 1 Great Good 2 Great Medium 2 3 Fair Bad 4 Bad Awful Number of cases read: 2 Number of cases listed: 2 . DATASET NAME FwrdPair . *--SAVE OUTFILE=FwrdPair . * ...... II. Pairs in reverse order ...... . . DATASET ACTIVATE InptData. . DATASET COPY RvrsPair. . DATASET ACTIVATE RvrsPair. *--GET FILE=InptData. SORT CASES BY Dyad# (A) Subject#(D). CASESTOVARS /ID = Dyad# /GROUPBY = INDEX . Cases to Variables |----------------------------|---------------------------| |Output Created |19-MAR-2007 01:16:26 | |----------------------------|---------------------------| [RvrsPair] Generated Variables |----------|----------| |Original |Result | |Variable |----------| | |Name | |--------|-|----------| |Subject#|1|Subject#.1| | |2|Subject#.2| |--------|-|----------| |Well.Bng|1|Well.Bng.1| | |2|Well.Bng.2| |--------|-|----------| |Rel.Sat |1|Rel.Sat.1 | | |2|Rel.Sat.2 | |--------|-|----------| Processing Statistics |---------------|---| |Cases In |4 | |Cases Out |2 | |---------------|---| |Cases In/Cases |2.0| |Out | | |---------------|---| |Variables In |4 | |Variables Out |7 | |---------------|---| |Index Values |2 | |---------------|---| . /**/ LIST /*-*/. List |-----------------------------|---------------------------| |Output Created |19-MAR-2007 01:16:26 | |-----------------------------|---------------------------| [RvrsPair] Dyad# Subject#.1 Well.Bng.1 Rel.Sat.1 Subject#.2 Well.Bng.2 Rel.Sat.2 1 2 Great Medium 1 Great Good 2 4 Bad Awful 3 Fair Bad Number of cases read: 2 Number of cases listed: 2 *--SAVE OUTFILE=RvrsPair. DATASET ACTIVATE RvrsPair. * ...... III. Pairs in two orders combined ...... . NEW FILE. ADD FILES /FILE=FwrdPair /FILE=RvrsPair /BY Dyad#. LIST. List |-----------------------------|---------------------------| |Output Created |19-MAR-2007 01:18:16 | |-----------------------------|---------------------------| Dyad# Subject#.1 Well.Bng.1 Rel.Sat.1 Subject#.2 Well.Bng.2 Rel.Sat.2 1 1 Great Good 2 Great Medium 1 2 Great Medium 1 Great Good 2 3 Fair Bad 4 Bad Awful 2 4 Bad Awful 3 Fair Bad Number of cases read: 4 Number of cases listed: 4 =================== APPENDIX: Test data =================== * ............ Test data ............ . DATA LIST LIST SKIP=1/ Subject# Dyad# (2F3) Well.Bng Rel.Sat(2A06). BEGIN DATA subject # dyad # well-being rel sat 1 1 Great Good 2 1 Great Medium 3 2 Fair Bad 4 2 Bad Awful END DATA. |
| Free forum by Nabble | Edit this page |
