I want to create dot graph where for each variable i see two different means. Below is sample how i managed to recreate tempvars just for purpose of making graph dot. However, now i have a problem of sorting these variables, i.e. sort SD and gsort SD both sort my tempvar, but when i create graph with it, it still shows as if it is not sorted. Also, sort option in graph dot is not making it sorted. What might be a problem?
Also i am struggling to find right option in order to change legend labels from "mean of _var1 / mean of _var2" to something different and to make them one one above the other, rather than one next to the other horizontally. Thanks for any suggestions
Also i am struggling to find right option in order to change legend labels from "mean of _var1 / mean of _var2" to something different and to make them one one above the other, rather than one next to the other horizontally. Thanks for any suggestions
Code:
tempvar graphcat SD SDw
gen `graphcat'=""
gen `SD' =.
gen `SDw' =.
local graphvars var1 var2 var3 var4 var5
local i = 1
foreach gv of local graphvars{
replace `graphcat' = "`gv'" in `i'/`i'
local i=`i'+1
}
foreach gv of local graphvars{
replace `SD' = abs_`gv'_STD if `graphcat' == "`gv'"
replace `SDw' = abs_`gv'_STDw if `graphcat' == "`gv'"
}
gsort -`SD'
graph dot `SD' `SDw', over(`graphcat', sort( `SD') descending) yline(10)
drop `graphcat' `SD' `SDw'

Comment