Regarding #567, another option is to use autorename, a user written command:
Code:
ssc install autorename, replace sysuse auto, clear autorename
ssc install autorename, replace sysuse auto, clear autorename
sysuse auto xcontract rep78 foreign, saving(filename) frame command ...
sysuse auto
graph bar price, over(rep78) legend(row(1)) bargap(20) asyvars bar(1, bcolor(%50)) bar(2, bcolor(red%50))...
graph bar price, over(rep78) legend(row(1)) bargap(20) asyvars bar(1/5, bcolor(%50 red%50...))
sysuse auto gen id=_n foreach v of varlist price mpg weight length { egen std_`v'=std(`v') } twoway line std_price std_mpg std_weight std_length id, legend(row(1) label(1 "price") label(2 "mpg") label(3 "weight") label(4 "length")) twoway line std_price std_mpg std_weight std_length id, legend(row(1) order(1 "price" 2 "mpg" 3 "weight" 4 "length"))
sysuse auto gen id=_n foreach v of varlist price mpg weight length { egen std_`v'=std(`v') } twoway line std_price std_mpg std_weight std_length id, legend(row(1) label(1 "price") label(2 "mpg") label(3 "weight") label(4 "length")) twoway line std_price std_mpg std_weight std_length id, legend(row(1) order(1 "price" 2 "mpg" 3 "weight" 4 "length"))
[R] margins, generate() [FN] rpareto() [G-2] gs_fileinfo [G-2] twoway__histogram_gen [M-5] rdirichlet() [M-5] vech_lower() [P] varclassify
help vl
clear set obs 10 gen v1 = "a" + strofreal(_n, "%2.0f") gen condfail = cond(ustrregexm(v1, "[^\d](\d)$"), ustrregexs(1), "") gen wanted = ustrregexs(1) if ustrregexm(v1, "[^\d](\d)$") list
. list +-------------------------+ | v1 condfail wanted | |-------------------------| 1. | a1 1 | 2. | a2 1 2 | 3. | a3 2 3 | 4. | a4 3 4 | 5. | a5 4 5 | |-------------------------| 6. | a6 5 6 | 7. | a7 6 7 | 8. | a8 7 8 | 9. | a9 8 9 | 10. | a10 | +-------------------------+
Comment