What the commands will show: 

sum: obs, mean, std. dev. min and maz

describe: storage type, display format, value lable

storage type

1. byte

2. int: like number, but not number

3. string: word

**Make sure the missing data isn't missing in generate a new variable

you have two ways to do that

(1)replace war=. if hostlev ==.

gen war=.
replace war=1 if hostlev >=4
replace war=0 if hostlev <=3
replace war=. if hostlev ==.
*if you didn't write "replace war=. if hostlev ==.", even if you "gen war=.", the missing data wold be consider as >=4

(2)

* you could do it in a much more longer way, you write out all the possibility of the data
*like below
gen war=.
replace war=1 if hostlev ==4
replace war=1 if hostlev ==5
replace war=0 if hostlev ==3
replace war=0 if hostlev ==2
replace war=0 if hostlev ==1

 

 

 

創作者介紹
創作者 Douceline 的頭像
Douceline

小國民眾思維

Douceline 發表在 痞客邦 留言(0) 人氣()