clear
use gender
edit
clear
edit
insheet using stata2.txt
edit
edit
edit
clear
use gender
edit
desc gender'
desc gender
des gender
describe
edit
edit
sum I1
tab I1
tab I1 , nolabel
tab I4
tab I4 , nolabel
gen weight = I2
edit
edit
tab weight
recode weight (997=.) (998=.)
tab weight
label variable "體重"
label variable "體重 "
label variable weight "體重 "
tab weight]'
tab weight
sum weight'
sum weight
sum weight , detail
gen height = I1 - 100
drop height
gen height = I1
edit
tab height
recode height (997=.)
edit
des
edit
tab A1
tab A1, nolabel
gen female =1 if A1 ==2
edit
replace female = 0 if A1 ==1
edit
edit
tab femlae
tab female
sum A1
sum weight
sum weight , detail
tweight
tab weight
des
gen worksatis = G53
tab worksatis
tab G53
recode worksatis (99=.)
tab worksatis
sum worksatis
ci weight
ci weight , level(99)
help ci
ttest weight = 65
ttest
ttest height = 170
bysort
bysort female : sum weight
ss
des
tab RYA2
bysort RYA2 : sum weight
sum RYA2 , detail
tab RYA2
gen agef = 1 if RYA2 < 34
edit
replace agef = 2 if RYA2 >= 34
replace agef = 3 if RYA2 > 49
edit
tab agef
bysort agef : sum weight
bysort female agef : sum weight
bysort agef female : sum weight
bysort female agef : ttest weight = 50
bysort female agef : ttest weight = 50 if female == 0
bysort female agef : ttest weight = 50 if agef == 1
bysort agef female : ttest weight = 60 , level(99)
bysort female agef : ttest weight = 50 if agef == 1 , level(99)
tab agef
label define aagef 1 "年輕" 2 "中年" 3 "老年"
label values agef aagef
tab agef
tab agef , nolabel
---------------------------------------------------------
天書
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.157.145