syntax - Assigning partner values for paired rows in SPSS -


Imagine a dataset with participants' pairs ("duets" 1-10), each of which has a unique identifier ("Person" 1 side 2). Within each couple, each of these has a unique value on some variables, it is called "actor". I want to write a script that is considered "actor" for the person and it is called "companion" Puts in the pair. Thus, the value of each person (line) is their own ("actor") and their partner ("partner") is the value.

The method I have tried has included reconstruction:

  sorted by doubles. CaseStovars / ID = Couple / Groupb = variable Computer Partner 1 = Actor 2 COMPUTE partner = 2 actors. Executed. VARSTOCASES / person to person 1 person 2 / actor to actress 1 actor. Actor 2 / Partner 1 Partner 2 to Partner 2 / Index = Index 1 (2) / KEP = Couple / Null = KEP  

Now it's complete for small, fictional datasets made for me However, I want to be able to handle more variables in the script, without the commands to manually type / make the user more manually.

Something like this?

  I do VARSTOCASES [var = all] in varlist / i.1 to i.2 / INDEX = index 1 (2).  

But this is not a valid SPSS code. Anyone knows how I can do it?

Thank you!

The following code should do the trick:

  Doubles (A) Sorted by (A) Sort CAS. If the (case = lag (pair)) companion = lag (actor) couple (a) person (d) according to the case of the house (pair = lag (couple)) partner = lag (actor)  

Explanation: First, you sort your data set in a way that every actor is followed by him, after which you will be the actor's ID (from the top row) partner (Second line) sub-lag-function to copy into the partner variable Industry can. Since there is no such action as a follower in STPSS (I'm really remembering it) you can not copy a price directly from the second line. You must first sort the person in a descending order.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -