- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I want to create a new variable called new var
conditions for recoding are:
if var1 = 'A' and all other var2 - var5 are blank then newvar = A;
if var1 = 'A' and any of the var2-var5 are B and nothing else in the vars (should be blank) then newvar = AB
if var1='A' and var2= 'R' then newvar but all other vars should be null or blank = AR;
| VAR1 | VAR2 | VAR3 | VAR4 | VAR5 | VAR6 | Newvar |
| A | A | |||||
| A | B | AB | ||||
| A | B | AB | ||||
| A | B | AB | ||||
| A | B | AB | ||||
| A | R | AR | ||||
| A | B | R | ABR | |||
| A | R | R | ARR | |||
| A | R | AR |
Basically I need help with how to tell if statement to make sure that the combination is correct provided all other variables are null.
Thanks
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Is your second last record correct or should it be ARR?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yes it should be ARR.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@AZIQ1 wrote:
Yes.
That's an or question not a yes/no question. Please take the time to detail your question and answers otherwise why should we take the time to answer them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, my bad, yes it should be ARR.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You should post samples that include what happen in other conditions, ie what if they're not blank.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you - it should be "unknown" if none of the conditions meet.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What about
x=CATT(of var1-var6);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content