I want to transform the variable to only include values from 15th to 80th percentile of that data. What is the code for that?
Any help shall be highly appreciated!
Any help shall be highly appreciated!
cap which dichoct // check whether -dichoct- is already installed if _rc ssc install dichoct // install -dichoct- if necessary sysuse auto, clear tab1 length // you would look at the cum. perc. to do it by hand dichoct length, centile(15) gen(length_15) // optimal split at lowest 15% dichoct length, centile(80) gen(length_80) // optimal split at highest 20% tab2 length_15 length_80, col row // show optimal splits gen length_15_80 = length if length_15==1 & length_80==0 // length betw. 15% and 80% sum length length_15_80 // compare descriptive statistics of old and new variable
Comment