hello
I have a question needs to help.
Z code mode
I want to category Z variable
below as
gen zcode = 0
replace zcode =4 if z > 3
replace zcode =3 if z > 2.7 &(z <3)
replace zcode=2 if z > 1.8 &(z <2.7)
replace zcode=1 if z< 1.8

However, the above procedure is wrong
I presume to need a loop procedure
but I don't know how to make
please help me

就會出來這個 就可以去問高手了

----------------------- copy starting from the next line -----------------------

Code:
* Example generated by -dataex-. To install: ssc install dataex

clear

input double z

 .9511019587516785

 1.155989170074463

1.1604379415512085

1.3545799255371094

  .932868242263794

 1.278079628944397

 1.486504077911377

1.6408237218856812

 1.158469796180725

1.3165580034255981

end
------------------ copy up to and including the previous line ------------------