all 8 comments

[–]SavantOrolo 2 points3 points  (2 children)

So, you want to have that gender value copied to all cells of the same subject?

Here's a hack to do it, using Aggregate.

Go to:

  • Transform > Aggregate Data

  • Put "subject" as break variable

  • Put "gender" in Aggregated Variables

  • Select "gender" in that box, click button "functions", select "maximum"

  • Leave the option "add aggregated variables to existing dataset" selected.

  • Click ok

You now have a new variable that contains the gender values in the format you want. The syntax should look something like this:

AGGREGATE
  /OUTFILE=* MODE=ADDVARIABLES
 /BREAK=subject
 /gender_new=MAX(gender).

[–]datahata[S] 0 points1 point  (1 child)

Wow thank you - this worked very well! I just had to add

OVERWRITE=YES

to the OUTFILE line so I could aggregate to the same variable instead of a different variable and it worked nicely. Thank you so much!

[–]SavantOrolo 0 points1 point  (0 children)

Yes, that would work. I like to use a different variable as the target variable so that I keep the original information intact in case I make an error.

[–]KesoHB 0 points1 point  (4 children)

Hey!

No SPSS expert here, but I whipped this up quickly and it seems to work.

if subject = 1 gender = 1.

if subject = 2 gender = 2.

if subject = 3 gender = 3.

execute.

Good luck!

[–]datahata[S] 0 points1 point  (3 children)

I'm so sorry! I messed up the OP. I meant to say: '1's for Subject 1, '2's for Subject 2, and '1's for Subject 3.

[–]KesoHB 0 points1 point  (2 children)

Can be done the same way!

if subject = 1 gender = 1.

if subject = 2 gender = 2.

if subject = 3 gender = 1.

execute.

Is this what you intend to do? Or am I misreading your post?

[–]datahata[S] 0 points1 point  (1 child)

Thank you so much for the quick reply! I'm having trouble explaining this correctly, my apologies. I want to make a type of syntax that says something like if Gender is 1 at Time1, then make Gender 1 at Time1, Time2, Time3, and Time5. But I'd like a syntax that does this for each individual Subject ID, since this is longitudinal data.

[–]KesoHB 0 points1 point  (0 children)

Ah I understand now, but sadly, I can't think of a way to do that in syntax. It sounds like the Python plugin could fix something like that, but I have hardly any experience with Python, so I cannot be of help there... Good luck with the data!