Desktop productivity for business analysts and programmers

Proc glm help needed

Reply
DDD
N/A
Posts: 1

Proc glm help needed

Hello,
I am trying to analyze the data using proc glm and i'm having trouble with contrast.
If I want to assign 1 0 -1 to AL AM AH repectively, what should I do?
Also, if I want to put 'group' as a class variable, do I need to put 'group' in the model?

Can anyone help me out with these kind of problems today and tomorrow?
If so, e-mail me at dsuh38@hotmail.com
I will pay for it. Thank you.


data forglm;
input ID group stimset c1 $ c2 $ c3 $ adlevel1 $ adlevel2 $ adlevel3 $
a1 a2 a3 t1 t2 t3 f1 f2 f3 v1 v2 v3;

*KEY:

c - candidate
adlevel - ad frequency
a - ad liking
t - candidate trustworthiness
f - candidate familiarity
v - intention to vote for the candidate

_1, _2, _3 indicate 1st, 2nd, and 3rd measures, respectively

_L, _M, _H indicate measures for the low, medium, and high ad levels, respectively;

if c1='A' then do;
aa=a1; ta=t1; fa=f1; va=v1; end;
if c1='B' then do;
ab=a1; tb=t1; fb=f1; vb=v1; end;
if c1='C' then do;
ac=a1; tc=t1; fc=f1; vc=v1; end;

if c2='A' then do;
aa=a2; ta=t2; fa=f2; va=v2; end;
if c2='B' then do;
ab=a2; tb=t2; fb=f2; vb=v2; end;
if c2='C' then do;
ac=a2; tc=t2; fc=f2; vc=v2; end;

if c3='A' then do;
aa=a3; ta=t3; fa=f3; va=v3; end;
if c3='B' then do;
ab=a3; tb=t3; fb=f3; vb=v3; end;
if c3='C' then do;
ac=a3; tc=t3; fc=f3; vc=v3; end;

if adlevel1='L' then do;
AL=a1; TL=t1; FL=f1; VL=v1; end;
if adlevel1='M' then do;
AM=a1; TM=t1; FM=f1; VM=v1; end;
if adlevel1='H' then do;
AH=a1; TH=t1; FH=f1; VH=v1; end;

if adlevel2='L' then do;
AL=a2; TL=t2; FL=f2; VL=v2; end;
if adlevel2='M' then do;
AM=a2; TM=t2; FM=f2; VM=v2; end;
if adlevel2='H' then do;
AH=a2; TH=t2; FH=f2; VH=v2; end;

if adlevel3='L' then do;
AL=a3; TL=t3; FL=f3; VL=v3; end;
if adlevel3='M' then do;
AM=a3; TM=t3; FM=f3; VM=v3; end;
if adlevel3='H' then do;
AH=a3; TH=t3; FH=f3; VH=v3; end;

cards;

1 1 1 A B C L M H 7 -1 -2 9 4 4 10 3 6 49 58 67
2 2 1 C A B H L M -5 3 -2 5 2 2 5 3 2 62 42 53
3 3 1 B C A M H L 0 -6 4 1 5 4 -1 5 4 51 63 45
4 4 2 C B A L H M 5 -5 1 5 6 2 6 6 1 66 56 42
5 5 2 A C B M L H 0 3 -6 -3 2 3 -1 3 3 36 61 50
6 6 2 B A C H M L -5 1 5 5 1 6 5 2 6 54 40 67
7 7 3 A C B H M L -4 -1 5 2 2 4 3 0 4 41 61 55
8 8 3 C B A M L H 0 5 -3 -1 2 6 -2 5 5 56 53 46
9 9 3 B A C L H M 4 -5 0 4 4 -1 4 5 0 54 42 60
10 1 1 A B C L M H 6 -1 -4 6 -2 1 7 1 3 47 49 60
11 2 1 C A B H L M -6 6 1 10 6 3 8 5 2 70 45 54
12 3 1 B C A M H L 0 -6 5 -2 6 2 -1 6 3 47 64 42
13 4 2 C B A L H M 3 -6 -2 6 7 5 3 5 3 63 56 41
14 5 2 A C B M L H 4 7 -3 0 10 1 2 8 3 41 73 52
15 6 2 B A C H M L -4 3 7 5 3 6 4 5 5 55 43 68
16 7 3 A C B H M L -4 -1 5 0 0 0 0 -1 2 39 60 49
17 8 3 C B A M L H 1 6 -5 3 8 9 2 6 6 63 60 50
18 9 3 B A C L H M 5 -6 1 8 6 4 7 7 2 57 43 62
19 1 1 A B C L M H 4 -2 -5 1 -2 3 1 0 5 41 48 62
20 2 1 C A B H L M -7 5 -2 8 8 0 8 7 1 64 48 50
21 3 1 B C A M H L -2 -6 3 3 8 1 3 7 3 55 70 45
22 4 2 C B A L H M 1 -5 -3 6 8 7 5 7 4 68 60 49
23 5 2 A C B M L H -5 3 -7 7 4 10 6 2 8 47 64 58
24 6 2 B A C H M L -6 -1 5 1 0 1 4 0 4 50 40 60
25 7 3 A C B H M L -4 -1 6 0 -1 5 1 0 5 41 58 53
26 8 3 C B A M L H -1 4 -4 1 6 3 1 4 1 59 54 41
27 9 3 B A C L H M 5 -4 0 8 6 0 5 5 -1 58 46 59
28 1 1 A B C L M H 6 1 -5 7 4 4 6 2 3 45 53 62
29 2 1 C A B H L M -5 5 -1 5 7 1 5 6 1 62 46 51
30 3 1 B C A M H L 0 -3 6 -2 3 10 -1 3 9 49 66 49
31 4 2 C B A L H M 5 -6 0 4 9 0 2 4 -2 66 62 42
32 5 2 A C B M L H -1 4 -6 -2 2 4 -1 3 6 39 63 56
33 6 2 B A C H M L -4 0 5 5 -1 6 5 0 5 55 40 67
34 7 3 A C B H M L -3 1 5 8 5 8 4 3 8 46 67 58
35 8 3 C B A M L H 0 4 -5 -1 0 3 -1 2 4 59 49 44
36 9 3 B A C L H M 6 -4 -2 6 3 0 6 4 0 55 42 62
37 1 1 A B C L M H 6 0 -7 6 0 5 6 0 6 45 47 65
38 2 1 C A B H L M -5 3 0 5 3 0 5 3 0 65 46 52
39 3 1 B C A M H L 1 -4 7 -1 4 7 0 3 6 48 64 45
40 4 2 C B A L H M 5 -5 -2 5 5 1 6 6 1 64 55 42
41 5 2 A C B M L H 3 8 -2 4 7 1 3 6 1 43 65 50
42 6 2 B A C H M L -4 2 6 2 -2 4 4 -1 6 53 41 66
43 7 3 A C B H M L -6 -1 1 8 3 4 6 1 3 48 59 51
44 8 3 C B A M L H 0 5 -4 1 5 7 1 5 5 64 56 49
45 9 3 B A C L H M 6 -5 1 4 4 4 7 5 3 56 46 63
46 1 1 A B C L M H 8 3 -3 6 0 -2 5 1 1 46 50 58
47 2 1 C A B H L M -5 4 -1 3 3 0 4 4 0 61 42 48
48 3 1 B C A M H L 0 -7 4 0 7 6 1 6 6 49 66 46
49 4 2 C B A L H M 7 -4 1 8 6 2 7 6 2 67 55 41
50 5 2 A C B M L H 0 7 -4 2 5 4 0 4 4 42 66 54
51 6 2 B A C H M L -5 -1 4 9 2 5 6 2 4 57 41 64
52 7 3 A C B H M L -8 -3 4 10 5 5 10 4 5 50 65 55
53 8 3 C B A M L H -2 3 -5 1 0 5 2 1 5 61 52 44
54 9 3 B A C L H M 4 -4 0 3 2 -1 2 3 -1 53 43 58
55 1 1 A B C L M H 8 -1 -4 10 -2 2 7 -1 2 50 48 61
56 2 1 C A B H L M -5 6 3 4 6 -2 4 8 2 63 44 47
57 3 1 B C A M H L -1 -5 4 1 10 4 3 9 5 50 68 43
58 4 2 C B A L H M 4 -6 -1 0 5 0 4 6 3 58 52 39
59 5 2 A C B M L H -2 3 -5 2 2 5 2 1 4 43 63 54
60 6 2 B A C H M L -3 1 5 3 1 8 4 1 7 53 41 70
61 7 3 A C B H M L -6 0 4 6 1 4 9 3 7 47 62 56
62 8 3 C B A M L H 0 4 -4 2 5 3 2 5 5 63 54 45
63 9 3 B A C L H M 7 -3 2 7 5 4 5 4 2 54 42 63
64 1 1 A B C L M H 3 0 -7 -2 -3 4 1 0 6 40 48 66
65 2 1 C A B H L M -4 8 2 5 7 1 5 8 2 64 45 51
66 3 1 B C A M H L 3 -3 6 6 6 5 5 5 6 56 67 46
67 4 2 C B A L H M 5 -3 0 7 5 2 6 4 1 69 55 42
68 5 2 A C B M L H 2 5 -2 2 1 -2 2 4 1 41 58 47
69 6 2 B A C H M L -6 -1 2 2 0 2 3 -1 1 54 39 64
70 7 3 A C B H M L -5 -1 5 6 3 6 6 3 8 43 62 56
71 8 3 C B A M L H -1 5 -5 2 6 8 3 5 7 63 56 49
72 9 3 B A C L H M 3 -6 0 4 7 0 3 7 1 55 47 62
73 1 1 A B C L M H 3 1 -8 4 3 10 4 2 10 42 53 70
74 2 1 C A B H L M -8 3 -2 6 3 2 7 3 1 67 44 53
75 3 1 B C A M H L -2 -8 3 4 9 6 3 8 5 56 69 48
76 4 2 C B A L H M 6 -3 1 5 4 -2 5 4 -1 67 55 39
77 5 2 A C B M L H -3 5 -5 1 1 2 2 4 5 41 61 52
78 6 2 B A C H M L -4 1 5 -1 2 5 2 2 6 51 43 65
79 7 3 A C B H M L -3 -1 7 5 2 3 1 -1 4 45 63 54
80 8 3 C B A M L H -1 5 -5 3 5 6 2 4 6 64 54 45
81 9 3 B A C L H M 4 -7 -2 6 7 1 6 7 2 56 47 61
82 1 1 A B C L M H 4 0 -6 -1 -2 1 1 -1 3 40 48 62
83 2 1 C A B H L M -2 5 1 0 3 1 -1 3 0 59 41 51
84 3 1 B C A M H L -3 -7 4 3 6 4 3 5 3 51 65 43
85 4 2 C B A L H M 3 -6 -2 2 7 0 4 6 0 65 60 42
86 5 2 A C B M L H -1 3 -5 0 6 6 1 3 5 42 66 55
87 6 2 B A C H M L -5 -1 6 7 1 5 6 1 5 58 41 66
88 7 3 A C B H M L -4 1 6 4 -1 2 3 -1 4 44 59 53
89 8 3 C B A M L H 1 6 -7 3 10 10 1 8 8 65 61 51
90 9 3 B A C L H M 5 -6 -1 2 4 0 5 7 1 52 46 59
91 1 1 A B C L M H 4 -1 -6 5 2 5 6 1 5 44 53 65
92 2 1 C A B H L M -2 6 2 5 8 5 3 7 4 65 49 55
93 3 1 B C A M H L 0 -4 4 2 5 4 2 4 5 55 65 42
94 4 2 C B A L H M 5 -6 -1 5 7 0 6 6 1 66 57 39
95 5 2 A C B M L H 1 6 -5 0 9 7 0 7 4 37 69 57
96 6 2 B A C H M L -6 0 7 8 2 7 8 2 6 58 40 65
97 7 3 A C B H M L -3 3 8 1 3 10 1 2 10 44 64 61
98 8 3 C B A M L H -1 4 -7 -1 2 4 0 0 5 59 54 46
99 9 3 B A C L H M 6 -4 0 5 5 1 7 5 1 56 46 63
100 1 1 A B C L M H 5 2 -5 5 2 6 5 0 5 47 54 67
101 2 1 C A B H L M -5 4 1 4 -1 0 4 3 0 62 40 50
102 3 1 B C A M H L -3 -6 4 5 6 6 4 6 6 55 66 49
103 4 2 C B A L H M 6 -5 0 8 7 0 8 7 1 69 58 42
104 5 2 A C B M L H 0 5 -5 1 5 5 -2 2 3 43 64 56
105 6 2 B A C H M L -6 0 6 6 2 6 5 1 6 54 40 65
106 7 3 A C B H M L -7 0 5 9 1 6 9 0 6 50 60 56
107 8 3 C B A M L H 2 7 -4 1 8 5 1 8 6 61 59 45
108 9 3 B A C L H M 4 -6 -3 0 5 2 1 6 2 51 45 61

;

proc print data=forglm;
run;

data formixed; set forglm;
keep ID group product adlevel adlevelx order adatt fam trust vote;
candidate=c1;
adlevel=adlevel1;
adlevelx=0; if adlevel='L' then adlevelx=-1; if adlevel='H' then adlevelx=1;
order=1;
adatt=a1;
fam=f1;
trust=t1;
vote=v1;
output;

candidate=c2;
adlevel=adlevel2;
adlevelx=0; if adlevel='L' then adlevelx=-1; if adlevel='H' then adlevelx=1;
order=2;
adatt=a2;
fam=f2;
trust=t2;
vote=v2;
output;

candidate=c3;
adlevel=adlevel3;
adlevelx=0; if adlevel='L' then adlevelx=-1; if adlevel='H' then adlevelx=1;
order=3;
adatt=a3;
fam=f3;
trust=t3;
vote=v3;
output;

proc print data=formixed;
run;

Proc glm data=forglm;
class adlevel1 adlevel2 adlevel3;
model AL AM AH = adlevel1 adlevel2 adlevel3 / nouni;
repeated frequency 3 (1 3 5) / printe summary;
run;
Proc glm data=forglm;
class group adlevel1 adlevel2 adlevel3;
model AL AM AH = group adlevel1 adlevel2 adlevel3 / nouni;
repeated frequency 3 (1 3 5) / printe summary;
run;

Proc glm data=forglm;
class group adlevel1 adlevel2 adlevel3;
model AL AM AH = group adlevel1 adlevel2 adlevel3 / nouni;
contrast 'contrast1' AL AM AH <1 0 -1>;
repeated frequency 3 (1 3 5) / printe summary;
run;
Ask a Question
Discussion stats
  • 0 replies
  • 80 views
  • 0 likes
  • 1 in conversation