Discussion:
count values within case
(too old to reply)
Alba Johnsen
2020-08-25 10:22:48 UTC
Permalink
Hi,
I have a variable which has 5 values. I need to mix 1,2,3 and 6,7 together. to make a 2 variable, but I dont know how. Please help!!!

The item is : What did you do with your photos
1. I shared them
2.I plan to share them
3. I streamed when I was in the concer

6. I didnt share it
7. nothing


so now I need to make a new variable with 1,2,3
and 6,7

to do Anova
Bruce Weaver
2020-08-25 12:37:17 UTC
Permalink
Post by Alba Johnsen
Hi,
I have a variable which has 5 values. I need to mix 1,2,3 and 6,7 together. to make a 2 variable, but I dont know how. Please help!!!
The item is : What did you do with your photos
1. I shared them
2.I plan to share them
3. I streamed when I was in the concer
6. I didnt share it
7. nothing
so now I need to make a new variable with 1,2,3
and 6,7
to do Anova
Please generate a small data listing of several cases that shows what the data look like now, and what you want it to look like afterwards.
Rich Ulrich
2020-08-25 14:28:50 UTC
Permalink
On Tue, 25 Aug 2020 05:37:17 -0700 (PDT), Bruce Weaver
Post by Bruce Weaver
Post by Alba Johnsen
Hi,
I have a variable which has 5 values. I need to mix 1,2,3 and 6,7 together. to make a 2 variable, but I dont know how. Please help!!!
The item is : What did you do with your photos
1. I shared them
2.I plan to share them
3. I streamed when I was in the concer
6. I didnt share it
7. nothing
so now I need to make a new variable with 1,2,3
and 6,7
to do Anova
Please generate a small data listing of several cases that shows what the data look like now, and what you want it to look like afterwards.
My guess is that the intention is to create a dichotomy, in
a new variable. Thus.

RECODE Photos(1,2,3=1)(6,7=2)(else=9) into Share .
Value labels Share(1) share (2) not share.
--
Rich Ulrich
Bruce Weaver
2020-08-25 15:23:30 UTC
Permalink
Post by Rich Ulrich
On Tue, 25 Aug 2020 05:37:17 -0700 (PDT), Bruce Weaver
Post by Bruce Weaver
Post by Alba Johnsen
Hi,
I have a variable which has 5 values. I need to mix 1,2,3 and 6,7 together. to make a 2 variable, but I dont know how. Please help!!!
The item is : What did you do with your photos
1. I shared them
2.I plan to share them
3. I streamed when I was in the concer
6. I didnt share it
7. nothing
so now I need to make a new variable with 1,2,3
and 6,7
to do Anova
Please generate a small data listing of several cases that shows what the data look like now, and what you want it to look like afterwards.
My guess is that the intention is to create a dichotomy, in
a new variable. Thus.
RECODE Photos(1,2,3=1)(6,7=2)(else=9) into Share .
Value labels Share(1) share (2) not share.
--
Rich Ulrich
Ah, okay. That makes sense. But what happened to 4 and 5?

If it is a dichotomous Yes/No variable named Share, my preference is to use 1=Yes, 0=No coding. So my version of Rich's code would be:

RECODE Photos (1 2 4 = 1) (6 7 = 0) (ELSE = 9) INTO Share.
FORMATS Share(F1).
VALUE LABELS Share 1 "Yes" 0 "No" 9 "Missing".
MISSING VALUES Share (9).

With this coding, I can write code such as:

IF Share ...
IF NOT Share ...

I think this is more readable than:

IF Share EQ 1 ...
IF Share EQ 2 ...

YMMV!
Bruce Weaver
2020-08-25 20:30:44 UTC
Permalink
Post by Bruce Weaver
Post by Rich Ulrich
On Tue, 25 Aug 2020 05:37:17 -0700 (PDT), Bruce Weaver
Post by Bruce Weaver
Post by Alba Johnsen
Hi,
I have a variable which has 5 values. I need to mix 1,2,3 and 6,7 together. to make a 2 variable, but I dont know how. Please help!!!
The item is : What did you do with your photos
1. I shared them
2.I plan to share them
3. I streamed when I was in the concer
6. I didnt share it
7. nothing
so now I need to make a new variable with 1,2,3
and 6,7
to do Anova
Please generate a small data listing of several cases that shows what the data look like now, and what you want it to look like afterwards.
My guess is that the intention is to create a dichotomy, in
a new variable. Thus.
RECODE Photos(1,2,3=1)(6,7=2)(else=9) into Share .
Value labels Share(1) share (2) not share.
--
Rich Ulrich
Ah, okay. That makes sense. But what happened to 4 and 5?
RECODE Photos (1 2 4 = 1) (6 7 = 0) (ELSE = 9) INTO Share.
--- snip ---

Oops! I meant 3 there, not 4:

RECODE Photos (1 2 3 = 1) (6 7 = 0) (ELSE = 9) INTO Share.

The rest of the code in my previous post is okay, I think.

Loading...