-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalysis full code.sas
More file actions
177 lines (136 loc) · 3.56 KB
/
analysis full code.sas
File metadata and controls
177 lines (136 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
libname fn 'C:\SASUniversityEdition\myfolders\RESEARCH\andgyn';
proc sort data=fn.all;
by nif;
proc sort data=fn.dxa;
by nif;
proc sort data=fn.v1be;
by nif;
proc sort data=fn.v1fe;
by nif;
proc sort data=fn.variables;
by nif;
run;
data allv1;
merge fn.all fn.dxa fn.v1be fn.v1fe fn.variables;
by nif;
run;
data fn.allv1;
set allv1;
run;
************************************************
************************************************
************************************************
******** v1 recodes and analysis ********
************************************************
************************************************
************************************************;
data allrc;
set fn.allv1;
andgyn= andfatv1/gynfatv1;
if BMIEFV1WHOP>= 85
then ovob=1;
if BMIEFV1WHOP<85 then ovob=0;
/*
protein_kcal=protein_g*4;
fat_kcal=fat_g*9;
sat_fat_kcal=saturated_fat_g*9;
sum=sum (of v1de5a, v1de5b, v1de5c);
perfat=(v1de5a/sum)*100;
perlean=(v1de5b/sum)*100;
perbone=(v1de5c/sum)*100;
andper=andfatv1/perfat;
gynper=gynfatv1/perfat;
perandgyn=andper/gynper;
BP = mean(v1fe19c, v1fe19d, v1fe19e);
BPdia = mean(v1fe21c, v1fe21d, v1fe21e);
BPsys = mean(v1fe20c, v1fe20d, v1fe20e);
*/
if v1fe27 = 1 then pubertyv1 = 0;
if v1fe27 = 2 or v1fe27 = 3 or v1fe27 = 4 then pubertyv1 =1;
if V1FE11C=. then CIRCHEFV1=MEAN(V1FE11A,V1FE11B);
if V1FE11C^=. then do;
diff1=abs(V1FE11A-V1FE11B);
diff2=abs(V1FE11A-V1FE11c);
diff3=abs(V1FE11B-V1FE11c);
if (diff1<= diff2) and (diff1<= diff3) then CIRCHEFV1=mean(V1FE11A,V1FE11B);
if (diff2<= diff3) and (diff2<= diff1) then CIRCHEFV1=mean(V1FE11A,V1FE11c);
if (diff3<= diff1) and (diff3<= diff2) then CIRCHEFV1=mean(V1FE11b,V1FE11c);
end;
waist_hipv1=CIRCTEFV1/CIRCHEFV1;
if andgyn=. then delete;
run;
proc ttest data=allrc;
class sexef;
var AGEEFV1 POIDSEFV1 v1be1a v1be1c v1be1d1 v1be3a v1be2a BMIEFV1WHOZ andgyn;
run;
proc freq data=allrc;
tables andgyn*pubertyv1 /chisq; run;
proc standard data=allrc out=standardizedv1 MEAN=0 STD=1;
var andgyn WHREFV1 CIRCTEFV1 waist_hipv1;
run;
proc sort data=standardizedv1;
by sexef; run;
%macro lreg (out, name);
proc reg data= standardizedv1;
title "&name";
by sexef;
where sexef^= .;
model &out = AGEEFV1 pubertyv1 andgyn;
run;
title;
%mend;
proc reg data=standardizedv1;
by sexef;
where sexef^= .;
model v1be1a= AGEEFV1 pubertyv1 CIRCTEFV1;
run;
%lreg(v1be1a, cholesterol);
%lreg(v1be1c, HDL);
%lreg(v1be1d1, LDL);
%lreg(v1be3a, insulin);
%lreg(v1be2a, glucose);
******** v1 variables ********
* waist_hipv1 waist to hip
* WHREFV1 waist to height ratio;
* CIRCTEFV1 waist circumference;
************************************************
************************************************
************************************************
******** v2 recodes and analysis ********
************************************************
************************************************
************************************************;
proc sort data=fnv2.v2be;
by nif;
proc sort data=fnv2.v2fe;
by nif;
proc sort data=fnv2.v2_derivees;
by nif;
run;
data allv2;
merge fnv2.v2be fnv2.v2fe fnv2.v2_derivees;
by nif;
run;
proc sort data=standardizedv1;
by nif; run;
data allv1v2;
merge standardizedv1 allv2;
by nif;
if v2fe27 = 1 then pubertyv2 = 0;
if v2fe27 = 2 or v2fe27 = 3 or v2fe27 = 4 then pubertyv2 =1;
if andgyn=. then delete;
run;
proc sort data=allv1v2;
by sexef;
run;
proc reg data=allv1v2;
by sexef;
where sexef^= .;
model v2be1a= AGEEFV1 pubertyv2 andgyn;
run;
******** v2 variables ********
WHIREFV2 waist to hip
WHREFV2 waist to HEIGHT
CIRCTEFV2 waist circumference
andgyn
;