How to copy from one variable to another on SPSS
How to copy from one variable to another on SPSS
I have a data set with two parent/carer respondents (main and partner) for each participant (child). For one of the variables, only one respondent has given an answer - usually the main respondent, but in some cases it was the partner respondent. I therefore need to fill in some missing main respondent data with data from the partner respondent.
My data looks roughly like this:
MAIN PARTNER I would like the final var as below:
2 -1 2
1 -1 1
-1 2 2
1 . 1
-9 2 2
-8 1 1
2 . 2
1 . 1
etc.
(-1, -8 and -9 are missing values)
All variables are numeric. Where a response is missing from the main respondent, I would like to fill it in from the partner. I cannot seem to get the DO IF/RECODE commands to work.
Any advice on how to do this in SPSS would be hugely appreciated!
1 Answer
1
More than one way to skin a cat. Depending on your taste, you might create your final variable responder
like so:
responder
MISSING VALUES main (-1,-8,-9) .
IF (MISSING(main)) responder=partner .
IF (NOT(MISSING(main))) responder=main .
EXE .
First assign your missing values. Then assign a value to responder
based on whether main
is missing. Note that MISSING(main)
will evaluate true when main has a specified missing value (in this case: -1, -8, or -9) or a system missing value.
responder
main
MISSING(main)
No problem @AmeliaM. -- happy to help! If you feel it answered your question please consider selecting it (using the check mark next to the response)
– user45392
Oct 26 '18 at 15:55
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Thank you so much, this was a huge help!
– Amelia M.
Oct 14 '18 at 14:04