Hi! This is a pretty basic question, but I can't figure it out. I'm trying to transform (recode) multiple variables into one, but the transform function only gives me the option of using the original source variable to pull the data. For example, I have several variables denoting race/ethnicity, and I want to pull them into one. So I want to combine all the people who identified as either Black, Asian, or Latinx into one variable. How do I do this recode other than manually?
Many thanks in advance!
-lina
Transform from multiple variables
Re: Transform from multiple variables
hi,
it's possible that if you're combining many variables, you may be better off just using the computed variables.
but whether you're using computed or transformed, you can refer to any extra columns you want by name.
if it's still not clear, if you can share a simplified example where you'd like to combine to columns, i should be able to give you a concrete solution.
cheers
jonathon
it's possible that if you're combining many variables, you may be better off just using the computed variables.
but whether you're using computed or transformed, you can refer to any extra columns you want by name.
if it's still not clear, if you can share a simplified example where you'd like to combine to columns, i should be able to give you a concrete solution.
cheers
jonathon
-
- Posts: 6
- Joined: Mon Nov 16, 2020 9:30 pm
Re: Transform from multiple variables
Hi Jonathon,
Thank you for the reply. I was able to do it with a mix of compute and then transform, per your suggestion.
Best wishes,
-lina
Thank you for the reply. I was able to do it with a mix of compute and then transform, per your suggestion.
Best wishes,
-lina
Re: Transform from multiple variables
Hi ! Could you share how you did it, Lina?
-
- Posts: 6
- Joined: Mon Nov 16, 2020 9:30 pm
Re: Transform from multiple variables
Hi raimoi,
I'm sorry I didn't see this message sooner - I didn't receive an email alerting me to your message.
The way I did it was I computed a sum variable of all the variables that I wanted in one condition, and then transformed that computed variable with the formula: if >1 (meaning: if any of the original variables showed up as true/checked off) then 1, and all else is 0.
This only worked because the variables were all binary. I'm not sure how I would do the recode otherwise. I hope this helps, and again apologies for the delay!
I'm sorry I didn't see this message sooner - I didn't receive an email alerting me to your message.
The way I did it was I computed a sum variable of all the variables that I wanted in one condition, and then transformed that computed variable with the formula: if >1 (meaning: if any of the original variables showed up as true/checked off) then 1, and all else is 0.
This only worked because the variables were all binary. I'm not sure how I would do the recode otherwise. I hope this helps, and again apologies for the delay!