Hi all.
I have a continuous variable called GLA ranging from 0.10 to 150.0 (and in some cases it was not measured in participants, so was coded as . for those participants)
I would like to rescale this so it is in quartiles
I have been having difficulty, as for some reason my code ends up replacing data that is actually missing (.) with a value of 4.
Here is my syntax: any help at all would be amazing!
gen gla_quart = .
replace gla_quart = 1 if gla>=0.1 & gla<=1.0
replace gla_quart = 2 if gla>=1.1 & gla<3.0
replace gla_quart = 3 if gla>=3.1 & gla<10.0
replace gla_quart = 4 if gla>10.1
I have a continuous variable called GLA ranging from 0.10 to 150.0 (and in some cases it was not measured in participants, so was coded as . for those participants)
I would like to rescale this so it is in quartiles
I have been having difficulty, as for some reason my code ends up replacing data that is actually missing (.) with a value of 4.
Here is my syntax: any help at all would be amazing!
gen gla_quart = .
replace gla_quart = 1 if gla>=0.1 & gla<=1.0
replace gla_quart = 2 if gla>=1.1 & gla<3.0
replace gla_quart = 3 if gla>=3.1 & gla<10.0
replace gla_quart = 4 if gla>10.1
Comment