Hi,
I am looking for a solution and would be very pleased to receive an answer....thank you!
I would like to calculate a variable and NOT set a filter:
if variable1>5 and variable2<5 use 1 and if variable1>5 and variable2>5 use 2
Greetings
Compute Variable with if...than....
Re: Compute Variable with if...than....
take a look here:
https://blog.jamovi.org/2018/10/23/transforming-variables.html
jonathon
https://blog.jamovi.org/2018/10/23/transforming-variables.html
jonathon
Re: Compute Variable with if...than....
Thank you very much for your answer!
But how does it works when there are two variables (so two §sources)?
Syntax in SPSS:
IF (subject of study = 1 and sex = 2) group = 1
If (subject of study = 3 and sex = 1) group = 2
Thank you!
But how does it works when there are two variables (so two §sources)?
Syntax in SPSS:
IF (subject of study = 1 and sex = 2) group = 1
If (subject of study = 3 and sex = 1) group = 2
Thank you!
Last edited by Lauri on Thu Dec 01, 2022 4:54 pm, edited 1 time in total.
Re: Compute Variable with if...than....
Thank you very much for your answer!
But how does it works when there are two variables (so two §sources)?
Syntax in SPSS:
IF (subject of study = 1 and sex = 2) group = 1
If (subject of study = 3 and sex = 1) group = 2
Thank you!
But how does it works when there are two variables (so two §sources)?
Syntax in SPSS:
IF (subject of study = 1 and sex = 2) group = 1
If (subject of study = 3 and sex = 1) group = 2
Thank you!
Re: Compute Variable with if...than....
with the transformed variables you can go:
if $source == 1 and sex == 2 use 1
if $source == 3 and sex == 1 use 2
or you could use computed variable, and go:
IF(`subject of study` == 1 and sex == 2, 1, IF(`subject of study` == 3 and sex == 1, 2))
cheers
if $source == 1 and sex == 2 use 1
if $source == 3 and sex == 1 use 2
or you could use computed variable, and go:
IF(`subject of study` == 1 and sex == 2, 1, IF(`subject of study` == 3 and sex == 1, 2))
cheers
Re: Compute Variable with if...than....
Thank you soooooo much!!!
Re: Compute Variable with if...than....
one more time
IF(IJP _036 == 1 or IJP_039 == 1, 1, 0) - > this one works out, but if one of the two cells is empty, I get no value, even if the condition for 1 or 0 is met
so I tried this one:
IF(IJP _036 == 1 or IJP_039 == 1, 1, 0, ignore_missing_1) ---> reply: error
How is it possible that values are output if one of the two conditions is met (IJP_36 == 1 or IJP_39 == 1), even if there is a missing value for one of the conditions?
I look forward to ideas and thank you very much
IF(IJP _036 == 1 or IJP_039 == 1, 1, 0) - > this one works out, but if one of the two cells is empty, I get no value, even if the condition for 1 or 0 is met
so I tried this one:
IF(IJP _036 == 1 or IJP_039 == 1, 1, 0, ignore_missing_1) ---> reply: error
How is it possible that values are output if one of the two conditions is met (IJP_36 == 1 or IJP_39 == 1), even if there is a missing value for one of the conditions?
I look forward to ideas and thank you very much
Re: Compute Variable with if...than....
hi,
could you attach the .omv file. this seems to be working for me:
could you attach the .omv file. this seems to be working for me:
Re: Compute Variable with if...than....
It is probably because I have not defined the missing values. My real file is a large data set and it would be very cumbersome to define all the missing values. In fact, if there are no values in A or B, it should also result in a "0" in C. Is there a trick to fill missing values = NA with "0"?
Thank you very much!
Thank you very much!
- Attachments
-
- Question.omv
- (2.07 KiB) Downloaded 98 times
Re: Compute Variable with if...than....
So for person 3 and 5 a "0" should also appear at C