Alternative IDE for Stata [closed] - stata
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I am used to R-studio for R, which has some features such as guessing what function you are trying to type, by pressing TAB .
However, I can't find any integrated development environments (IDE) for Stata.
Is there one?
You can use Sublime Text to highlight Stata code.
I'm not sure how to run code from Sublime in Stata using ctrl+d.
For highlighting follow this:
Download: Stata-tab.tmbundle.zip from:
http://bylr.net/3/2010/10/stata-bundle-for-textmate/
Then at command line type:
mv stata.tmLanguage /Users/kathrynvasilaky/Library/Application Support/Sublime Text 2/Packages
Then go to sublime text, open a do file, and at the bottom right hand corner on the extensions tab
There is no full-blown IDE for Stata. The question comes up pretty often at Stata User Group meetings, and StataCorp developers always say that they work in text editors. See http://fmwww.bc.edu/repec/bocode/t/textEditors.html -- there's plentiful customization for syntax highlighting in every major text editor, but that's as far as you would get, I am afraid.
HTH,
StasK
P.S. Now that I thought about it a bit more, it is possible to send your code from a text editor into Stata. There are some hints to that in the document I linked to, and it floated up on Statalist a bunch of times. I just was not paying close enough attention, as I simply do myfile whenever I make major changes.
P.P.S. (Aug 2016) I use WinEdt, and it has a Stata mod that can send do-files to execute in Stata. Still, that's no IDE in the sense that you don't see objects, variables, macros, etc.
If you are working on a Windows platform, Notepad++ is not a bad choice at all. I'm quite happy about it. It's a versatile, easy-to-use and rather light editor.
On the following page you will find some instructions to integrate Notepad++ and Stata
http://code.google.com/p/kk-adofiles/
I have never used it, but as it seems, it is possible to set up auto-completion:
http://code.google.com/p/notepad-stats-integration/wiki/Instructions
Creating an IDE like Spyder or RStudio would require StataCorp to dedicate considerable resources. Since the current environment is "good enough" for the majority of the company's target audience, do not expect any considerable updates on this front anytime soon.
Visual Studio Code is now a great cross-platform development solution. As i have already stated recently in a similar post, this is a streamlined code editor, which is now mature enough and offers a very flexible environment for programming. Once installed, one can obtain the necessary add-on package for Stata syntax highlighting from the Visual Studio Marketplace. It is regularly updated and the user can expand its functionality using extensions. As such, if someone is programming in more than one language, s/he can keep everything under one roof. A nice extra is the built-in Git support, which is now pretty much the standard in version control. Using Stata Automation on a Windows computer, someone could potentially also link it to Stata to run the code in do files. However, i have yet to see this in practice yet (there has been an attempt to do this in Linux though).
I think this is the closest one can get to an IDE environment for Stata, at least for the time being.
Sublime Text 2 with the TextMate Stata bundle is quite good. I find myself regularly typing the same commands over and over in Stata, so Sublime Text 2's autocompletion provides fairly decent coverage, although it only suggests things you've already typed.
The Guide to Integrating Stata with text editors is a wealth of information here. Still just a text editor, but better than nothing.
http://huebler.blogspot.com/2008/04/stata.html
I've used UltraEdit and jEdit and SciTE with Stata. UE code highlighting was the most consistent, but it's non-free.
I think Gideon W has it right - Notepad++ is the way to go. I work at an Economics Consulting firm and we all use NPP (notepad++) to edit our do files. In addition to the ability to run everything from NPP directly, there's some syntax highlighting available. It's stable, fast, and designed for coders.
Just try everything out and see which one you like the best. While there's no perfect solution, with the right combination of plugins you can get NPP to do just about everything Stata's do-editor can do and much, much more.
Notepad++ Download
Save this code as userDefineLang.xml in your %APPDATA%/Notepad++ folder (I don't know where this is originally from, but it's been floating around on our internal servers for a while now) to get NPP to do syntax/keyword highlighting:
<NotepadPlus>
<UserLang name="Stata Commands" ext="do ado DO ADO">
<Settings>
<Global caseIgnored="yes" />
<TreatAsSymbol comment="no" commentLine="no" />
<Prefix words1="no" words2="no" words3="no" words4="no" />
</Settings>
<KeywordLists>
<Keywords name="Delimiters">"`0"'0</Keywords>
<Keywords name="Folder+">prog</Keywords>
<Keywords name="Folder-">end</Keywords>
<Keywords name="Operators">- ! # $ % & . : [ ] ^ + < = ></Keywords>
<Keywords name="Comment"> 1 2 0* 0//</Keywords>
<Keywords name="Words1">do exit shell ado</Keywords>
<Keywords name="Words2">use clear preserve restore joinby merge append cross collapse contract reshape erase save insheet outsheet</Keywords>
<Keywords name="Words3">about ado an ano anov anova anovadef ap app appe appen append args as ass asse asser assert br break bro brow brows browse by bys byso bysor bysort cap capt captu captur capture cat cd char chdir checksum chelp cl class cli clis clist cmdlog compress conf confi confir confirm cons const constr constra constrai constrain constraint continue copy cor corr corre correl correla correlat correlate cou coun count cox cret cretu cretur creturn datasig datasign datasigna datasignat datasignatu datasignatur datasignature dec deco decod decode di di_g dir dis discard disp displ displa display do doe doed doedi doedit drop e ed edi edit else en enc enco encod encode erase eret eretu eretur ereturn err erro error ex exi exit expand fdades fdadesc fdadescr fdadescri fdadescrib fdadescribe fdasav fdasave fdause file filefilter fl fli flis flist foreach form forma format forv forva forval forvalu forvalue forvalues g ge gen gene gener genera generat generate gettoken gl glo glob globa global gprefs gr7 graph7 haver hexdump if include inf infi infil infile infix inp inpu input ins insheet insp inspe inspec inspect keep l la lab labe label li lis list loc loca local log lookup ls m ma mac macr macro man manova manovatest mark markin markout marksample mat mat_put_rr mata mata_clear mata_describe mata_drop mata_memory mata_mlib mata_mosave mata_rename mata_which matr matri matrix memory mkdir mleval mlmatbysum mlmatsum mlsum mlvecsum mor more mov move n net news no nobreak noi nois noisi noisil noisily notes_dlg numlist odbc on one onew onewa oneway order ou out outf outfi outfil outfile outs outsh outshe outshee outsheet parse pl plo plot plugin post postclose postfile postutil pr preserve pro progr progra program pwd q qu que quer query qui quie quiet quietl quietly ren rena renam rename replace restore ret retu retur return rmdir ru run sa sav save sca scal scala scalar se search serset set sh she shel shell sleep so sor sort sret sretu sretur sreturn su sum summ summa summar summari summariz summarize syntax sysdir ta tab tabd tabdi tabdis tabdisp tabu tabul tabula tabulat tabulate tempfile tempname tempvar timer token tokeni tokeniz tokenize translate translator transmap tsrevar ty typ type u unabcmd update us use vers versi versio version view wh whi which whil while win wind windo window winexec xmlsav xmlsave xmluse xsh xshe xshel xshell</Keywords>
<Keywords name="Words4">ac ac_7 acprplot acprplot_7 adjust adopath adoupdate alpha ameans anova_estat anova_terms aorder arch arch_dr arch_estat arch_p archlm areg areg_p arima arima_dr arima_estat arima_p asmprobit asmprobit_estat asmprobit_lf asmprobit_mfx__dlg asmprobit_p avplot avplot_7 avplots avplots_7 bcskew0 bgodfrey binreg bip0_lf biplot bipp_lf bipr_lf bipr_p biprobit bitest bitesti bitowt blogit bmemsize boot bootsamp bootstrap bootstrap_8 boxco_l boxco_p boxcox boxcox_6 boxcox_p bprobit brier brr brrstat bs bs_7 bsampl_w bsample bsample_7 bsqreg bstat bstat_7 bstat_8 bstrap bstrap_7 ca ca_estat ca_p cabiplot camat canon canon_8 canon_8_p canon_estat canon_p caprojection cc cchart cchart_7 cci censobs_table centile cf checkdlgfiles checkestimationsample checkhlpfiles ci cii classutil clear clo clog clog_lf clog_p clogi clogi_sw clogit clogit_lf clogit_p clogitp clogl_sw cloglog clonevar clslistarray cluster cluster_measures cluster_stop cluster_tree cluster_tree_8 clustermat cnr cnre cnreg cnreg_p cnreg_sw cnsreg codebook collaps4 collapse colormult_nb colormult_nw compare conren contract copyright copysource corc corr2data corr_anti corr_kmo corr_smc corrgram cox_p cox_sw coxbase coxhaz coxvar cprplot cprplot_7 crc cross cs cscript cscript_log csi ct ct_is ctset ctst_5 ctst_st cttost cumsp cumsp_7 cumul cusum cusum_7 cutil d datetof db dbeta de deff des desc descr descri describ describe destring dfbeta dfgls dfuller dirstats disp_res disp_s dotplot dotplot_7 dprobit drawnorm ds ds_util dstdize duplicates durbina dwstat dydx egen eivreg emdef eq ereg ereg_lf ereg_p ereg_sw ereghet ereghet_glf ereghet_glf_sh ereghet_gp ereghet_ilf ereghet_ilf_sh ereghet_ip est est_cfexist est_cfname est_clickable est_expand est_hold est_table est_unhold est_unholdok estat estat_default estat_summ estat_vce_only esti estimates etodow etof etomdy expandcl fac fact facto factor factor_estat factor_p factor_pca_rotated factor_rotate factormat fcast fcast_compute fcast_graph fh_st fillin find_hlp_file findfile findit findit_7 fit for for5_0 fpredict frac_154 frac_adj frac_chk frac_cox frac_ddp frac_dis frac_dv frac_in frac_mun frac_pp frac_pq frac_pv frac_wgt frac_xo fracgen fracplot fracplot_7 fracpoly fracpred fron_ex fron_hn fron_p fron_tn fron_tn2 frontier ftodate ftoe ftomdy ftowdate gamhet_glf gamhet_gp gamhet_ilf gamhet_ip gamma gamma_d2 gamma_p gamma_sw gammahet gdi_hexagon gdi_spokes genrank genstd genvmean gladder gladder_7 glim_l01 glim_l02 glim_l03 glim_l04 glim_l05 glim_l06 glim_l07 glim_l08 glim_l09 glim_l10 glim_l11 glim_l12 glim_lf glim_mu glim_nw1 glim_nw2 glim_nw3 glim_p glim_v1 glim_v2 glim_v3 glim_v4 glim_v5 glim_v6 glim_v7 glm glm_6 glm_p glm_sw glmpred glogit glogit_8 glogit_p gmeans gnbre_lf gnbreg gnbreg_5 gnbreg_p gomp_lf gompe_sw gomper_p gompertz gompertzhet gomphet_glf gomphet_glf_sh gomphet_gp gomphet_ilf gomphet_ilf_sh gomphet_ip gphdot gphpen gphprint gprobi_p gprobit gprobit_8 gr gr_copy gr_current gr_db gr_describe gr_dir gr_draw gr_draw_replay gr_drop gr_edit gr_editviewopts gr_example gr_example2 gr_export gr_print gr_qscheme gr_query gr_read gr_rename gr_replay gr_save gr_set gr_setscheme gr_table gr_undo gr_use graph grebar greigen greigen_7 greigen_8 grmeanby grmeanby_7 gs_fileinfo gs_filetype gs_graphinfo gs_stat gsort gwood h hadimvo hareg hausman he heck_d2 heckma_p heckman heckp_lf heckpr_p heckprob hel help hereg hetpr_lf hetpr_p hetprob hettest hilite hist hist_7 histogram hlogit hlu hmeans hotel hotelling hprobit hreg hsearch icd9 icd9_ff icd9p iis impute imtest inbase integ inten intreg intreg_7 intreg_p intrg2_ll intrg_ll intrg_ll2 ipolate iqreg ir irf irf_create irfm iri is_svy is_svysum isid istdize ivprob_1_lf ivprob_lf ivprobit ivprobit_p ivreg ivreg_footnote ivtob_1_lf ivtob_lf ivtobit ivtobit_p jackknife jacknife jknife jknife_6 jknife_8 jkstat joinby kalarma1 kap kap_3 kapmeier kappa kapwgt kdensity kdensity_7 ksm ksmirnov ktau kwallis labelbook ladder levels levelsof leverage lfit lfit_p lincom line linktest lloghet_glf lloghet_glf_sh lloghet_gp lloghet_ilf lloghet_ilf_sh lloghet_ip llogi_sw llogis_p llogist llogistic llogistichet lnorm_lf lnorm_sw lnorma_p lnormal lnormalhet lnormhet_glf lnormhet_glf_sh lnormhet_gp lnormhet_ilf lnormhet_ilf_sh lnormhet_ip lnskew0 loadingplot logi logis_lf logistic logistic_p logit logit_estat logit_p loglogs logrank loneway lookfor lowess lowess_7 lpredict lrecomp lroc lroc_7 lrtest lsens lsens_7 lsens_x lstat ltable ltable_7 ltriang lv lvr2plot lvr2plot_7 makecns manova_estat manova_p mantel mat_capp mat_order mat_rapp mata_matdescribe mata_matsave mata_matuse matalabel matcproc matlist matname matrix_input__dlg matstrik mcc mcci md0_ md1_ md1debug_ md2_ md2debug_ mds mds_estat mds_p mdsconfig mdslong mdsmat mdsshepard mdytoe mdytof me_derd mean means median memsize meqparse mer merg merge mfp mfx mhelp mhodds minbound mixed_ll mixed_ll_reparm mkassert mkmat mkspline ml ml_5 ml_adjs ml_bhhhs ml_c_d ml_check ml_clear ml_cnt ml_debug ml_defd ml_e0 ml_e0_bfgs ml_e0_cycle ml_e0_dfp ml_e0i ml_e1 ml_e1_bfgs ml_e1_bhhh ml_e1_cycle ml_e1_dfp ml_e2 ml_e2_cycle ml_ebfg0 ml_ebfr0 ml_ebfr1 ml_ebh0q ml_ebhh0 ml_ebhr0 ml_ebr0i ml_ecr0i ml_edfp0 ml_edfr0 ml_edfr1 ml_edr0i ml_eds ml_eer0i ml_egr0i ml_elf ml_elf_bfgs ml_elf_bhhh ml_elf_cycle ml_elf_dfp ml_elfi ml_elfs ml_enr0i ml_enrr0 ml_erdu0 ml_erdu0_bfgs ml_erdu0_bhhh ml_erdu0_bhhhq ml_erdu0_cycle ml_erdu0_dfp ml_erdu0_nrbfgs ml_exde ml_footnote ml_geqnr ml_grad0 ml_graph ml_hbhhh ml_hd0 ml_hold ml_init ml_inv ml_log ml_max ml_mlout ml_mlout_8 ml_model ml_nb0 ml_opt ml_p ml_plot ml_query ml_rdgrd ml_repor ml_s_e ml_score ml_searc ml_technique ml_unhold mlf_ mlog mlogi mlogit mlogit_footnote mlogit_p mlopts mnl0_ mprobit mprobit_lf mprobit_p mrdu0_ mrdu1_ mvdecode mvencode mvreg mvreg_estat nbreg nbreg_al nbreg_lf nbreg_p nbreg_sw nestreg newey newey_7 newey_p nl nl_7 nl_9 nl_9_p nl_p nl_p_7 nlcom nlcom_p nlexp2 nlexp2_7 nlexp2a nlexp2a_7 nlexp3 nlexp3_7 nlgom3 nlgom3_7 nlgom4 nlgom4_7 nlinit nllog3 nllog3_7 nllog4 nllog4_7 nlog_rd nlogit nlogit_p nlogitgen nlogittree nlpred note notes nptrend numlabel old_ver olo olog ologi ologi_sw ologit ologit_p ologitp op_colnm op_comp op_diff op_inv op_str opr opro oprob oprob_sw oprobi oprobi_p oprobit oprobitp opts_exclusive orthog orthpoly ovtest pac pac_7 palette parse_dissim pause pca pca_8 pca_display pca_estat pca_p pca_rotate pcamat pchart pchart_7 pchi pchi_7 pcorr pctile pentium pergram pergram_7 permute permute_8 personal peto_st pkcollapse pkcross pkequiv pkexamine pkexamine_7 pkshape pksumm pksumm_7 pnorm pnorm_7 poisgof poiss_lf poiss_sw poisso_p poisson poisson_estat pperron prais prais_e prais_e2 prais_p predict predictnl print prob probi probit probit_estat probit_p proc_time procoverlay procrustes procrustes_estat procrustes_p profiler prop proportion prtest prtesti pwcorr qby qbys qchi qchi_7 qladder qladder_7 qnorm qnorm_7 qqplot qqplot_7 qreg qreg_c qreg_p qreg_sw quadchk quantile quantile_7 range ranksum ratio rchart rchart_7 rcof recast recode reg reg3 reg3_p regdw regr regre regre_p2 regres regres_p regress regress_estat regriv_p remap renpfix repeat reshape robvar roccomp roccomp_7 roccomp_8 rocf_lf rocfit rocfit_8 rocgold rocplot rocplot_7 roctab roctab_7 rolling rologit rologit_p rot rota rotat rotate rotatemat rreg rreg_p runtest rvfplot rvfplot_7 rvpplot rvpplot_7 safesum sample sampsi savedresults saveold sc scatter scm_mine sco scob_lf scob_p scobi_sw scobit scor score scoreplot scoreplot_help scree screeplot screeplot_help sdtest sdtesti separate seperate serrbar serrbar_7 set_defaults sfrancia shewhart shewhart_7 signestimationsample signrank signtest simul simul_7 simulate simulate_8 sktest slogit slogit_d2 slogit_p smooth snapspan spearman spikeplot spikeplot_7 spikeplt spline_x split sqreg sqreg_p ssc st st_ct st_hc st_hcd st_hcd_sh st_is st_issys st_note st_promo st_set st_show st_smpl st_subid stack statsby statsby_8 stbase stci stci_7 stcox stcox_estat stcox_fr stcox_fr_ll stcox_p stcox_sw stcoxkm stcoxkm_7 stcstat stcurv stcurve stcurve_7 stdes stem stepwise stereg stfill stgen stir stjoin stmc stmh stphplot stphplot_7 stphtest stphtest_7 stptime strate strate_7 streg streg_sw streset sts sts_7 stset stsplit stsum sttocc sttoct stvary stweib suest suest_8 sunflower sureg survcurv survsum svar svar_p svmat svy svy_disp svy_dreg svy_est svy_est_7 svy_estat svy_get svy_gnbreg_p svy_head svy_header svy_heckman_p svy_heckprob_p svy_intreg_p svy_ivreg_p svy_logistic_p svy_logit_p svy_mlogit_p svy_nbreg_p svy_ologit_p svy_oprobit_p svy_poisson_p svy_probit_p svy_regress_p svy_sub svy_sub_7 svy_x svy_x_7 svy_x_p svydes svydes_8 svygen svygnbreg svyheckman svyheckprob svyintreg svyintreg_7 svyintrg svyivreg svylc svylog_p svylogit svymarkout svymarkout_8 svymean svymlog svymlogit svynbreg svyolog svyologit svyoprob svyoprobit svyopts svypois svypois_7 svypoisson svyprobit svyprobt svyprop svyprop_7 svyratio svyreg svyreg_p svyregress svyset svyset_7 svyset_8 svytab svytab_7 svytest svytotal sw sw_8 swcnreg swcox swereg swilk swlogis swlogit swologit swoprbt swpois swprobit swqreg swtobit swweib symmetry symmi symplot symplot_7 sysdescribe sysuse szroeter tab1 tab2 tab_or tabi table tabodds tabodds_7 tabstat te tes test testnl testparm teststd tetrachoric time_it tis tob tobi tobit tobit_p tobit_sw tostring total treat_ll treatr_p treatreg trim trnb_cons trnb_mean trpoiss_d2 trunc_ll truncr_p truncreg tsappend tset tsfill tsline tsline_ex tsreport tsrline tsset tssmooth tsunab ttest ttesti tut_chk tut_wait tutorial tw tware_st two twoway twoway__fpfit_serset twoway__function_gen twoway__histogram_gen twoway__ipoint_serset twoway__ipoints_serset twoway__kdensity_gen twoway__lfit_serset twoway__normgen_gen twoway__pci_serset twoway__qfit_serset twoway__scatteri_serset twoway__sunflower_gen twoway_ksm_serset typeof unab unabbrev uselabel var var_mkcompanion var_p varbasic varfcast vargranger varirf varirf_add varirf_cgraph varirf_create varirf_ctable varirf_describe varirf_dir varirf_drop varirf_erase varirf_graph varirf_ograph varirf_rename varirf_set varirf_table varlmar varnorm varsoc varstable varstable_w varstable_w2 varwle vce vec vec_fevd vec_mkphi vec_p vec_p_w vecirf_create veclmar veclmar_w vecnorm vecnorm_w vecrank vecstable verinst viewsource vif vwls wdatetof webdescribe webseek webuse weib1_lf weib2_lf weib_lf weib_lf0 weibhet_glf weibhet_glf_sh weibhet_glfa weibhet_glfa_sh weibhet_gp weibhet_ilf weibhet_ilf_sh weibhet_ilfa weibhet_ilfa_sh weibhet_ip weibu_sw weibul_p weibull weibull_c weibull_s weibullhet whelp wilc_st wilcoxon wntestb wntestb_7 wntestq xchart xchart_7 xcorr xcorr_7 xi xi_6 xpose xt_iis xt_tis xtab_p xtabond xtbin_p xtclog xtcloglog xtcloglog_8 xtcloglog_d2 xtcloglog_pa_p xtcloglog_re_p xtcnt_p xtcorr xtdata xtdes xtfront_p xtfrontier xtgee xtgee_elink xtgee_estat xtgee_makeivar xtgee_p xtgee_plink xtgls xtgls_p xthaus xthausman xtht_p xthtaylor xtile xtint_p xtintreg xtintreg_8 xtintreg_d2 xtintreg_p xtivp_1 xtivp_2 xtivreg xtline xtline_ex xtlogit xtlogit_8 xtlogit_d2 xtlogit_fe_p xtlogit_pa_p xtlogit_re_p xtmixed xtmixed_estat xtmixed_p xtnb_fe xtnb_lf xtnbreg xtnbreg_pa_p xtnbreg_refe_p xtpcse xtpcse_p xtpois xtpoisson xtpoisson_d2 xtpoisson_pa_p xtpoisson_refe_p xtpred xtprobit xtprobit_8 xtprobit_d2 xtprobit_re_p xtps_fe xtps_lf xtps_ren xtps_ren_8 xtrar_p xtrc xtrc_p xtrchh xtrefe_p xtreg xtreg_be xtreg_fe xtreg_ml xtreg_pa_p xtreg_re xtregar xtrere_p xtset xtsf_ll xtsf_llti xtsum xttab xttest0 xttobit xttobit_8 xttobit_p xttrans yx yxview__barlike_draw yxview_area_draw yxview_bar_draw yxview_dot_draw yxview_dropline_draw yxview_function_draw yxview_iarrow_draw yxview_ilabels_draw yxview_normal_draw yxview_pcarrow_draw yxview_pcbarrow_draw yxview_pccapsym_draw yxview_pcscatter_draw yxview_pcspike_draw yxview_rarea_draw yxview_rbar_draw yxview_rbarm_draw yxview_rcap_draw yxview_rcapsym_draw yxview_rconnected_draw yxview_rline_draw yxview_rscatter_draw yxview_rspike_draw yxview_spike_draw yxview_sunflower_draw zap_s zinb zinb_llf zinb_plf zip zip_llf zip_p zip_plf zt_ct_5 zt_hc_5 zt_hcd_5 zt_is_5 zt_iss_5 zt_sho_5 zt_smp_5 ztbase_5 ztcox_5 ztdes_5 ztereg_5 ztfill_5 ztgen_5 ztir_5 ztjoin_5 ztnb ztnb_p ztp ztp_p zts_5 ztset_5 ztspli_5 ztsum_5 zttoct_5 ztvary_5 ztweib_5</Keywords>
</KeywordLists>
<Styles>
<WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="FOLDEROPEN" styleID="12" fgColor="408080" bgColor="AFD1D8" fontName="" fontStyle="1" />
<WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="408080" bgColor="AFD1D8" fontName="" fontStyle="1" />
<WordsStyle name="KEYWORD1" styleID="5" fgColor="000000" bgColor="00FF00" fontName="" fontStyle="1" />
<WordsStyle name="KEYWORD2" styleID="6" fgColor="400040" bgColor="FFFF00" fontName="" fontStyle="1" />
<WordsStyle name="KEYWORD3" styleID="7" fgColor="5959FF" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="KEYWORD4" styleID="8" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" />
<WordsStyle name="COMMENT" styleID="1" fgColor="77773C" bgColor="FFFFFF" fontName="" fontStyle="2" fontSize="10" />
<WordsStyle name="COMMENT LINE" styleID="2" fgColor="727238" bgColor="FFFFFF" fontName="Verdana" fontStyle="2" fontSize="10" />
<WordsStyle name="NUMBER" styleID="4" fgColor="C40062" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="OPERATOR" styleID="10" fgColor="000080" bgColor="FFFFFF" fontName="" fontStyle="1" />
<WordsStyle name="DELIMINER1" styleID="14" fgColor="910000" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="DELIMINER2" styleID="15" fgColor="FF0080" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
</Styles>
</UserLang>
I’ve used Huebler’s original Notepad++ files to get the ability to run Stata code directly from Sublime Text 2.
Just download Huebler’s files from: http://enoriver.net/index.php/2008/09/10/edit-stata-do-files-with-notepad-2/
Then in ST2 go to Preferences>Key Bindings: User, and paste in the following code:
[ { "keys": ["f9"], “cmd”: ["C:\\ado\\personal\\rundo.exe", "$filepath//$filename"] } ]
Replacing with your preferred keybind and directory structure, of course. You can do the same with the rundolines.exe file as well.
It seems that EditPlus has a code completion file for Stata. I have never used this program but this seems to be what you are looking for.
Edit: Did a quick search and found this post, http://enoriver.net/index.php/2008/09/10/edit-stata-do-files-with-notepad-2/ It seems that you can setup Notepad++ (FREE!) to run with Stata quite well, might be worth looking into.
Related
Suest after AME- dy/dx not saving for suest
After running these command all day, my head is on fire, I am now reaching out. Please don't direct me to papers about Suest that are commonly mentioned on the web, I already checked them. It seems there is a problem with storing the dy/dx values of the AME to merge between different models in the suest command in order to perform the test command. What I would like to test is if the AME of the lower class/upper class/middle class in one regime/context is statistically significant from the lower class situated in another regime/context. Dependent variable: 3 categories: renter, mortgaged homeownership, outright homeownership. *Liberal_market mlogit owner_housing_debt2 United_States United_Kingdom Swizerland c.age_centered ib0.lower_class ib0.upper_class if homeownership_regimes==1 , baseoutcome(1) margins , dydx(lower_class upper_class) coeflegend post est store Liberal_market *Family_financial_support mlogit owner_housing_debt2 Belgium Finland France Ireland Luxembourg Norway Spain ib0.lower_class ib0.upper_class if homeownership_regimes==2 , baseoutcome(1) margins , dydx(lower_class upper_class) coeflegend post est store Family_financial_support est table Liberal_market Family_financial_support suest Liberal_market Family_financial_support **In the end, this is what I want to do: test [Liberal_market]1.lower_class =[Family_financial_support]1.lower_class *error message Liberal_market was estimated with a nonstandard vce (delta) r(322); -Unfortunately, the following answer from Statalist regarding the nonstandard vce in suest- didn’t help me either https://www.statalist.org/forums/forum/general-stata-discussion/general/1511169-can-not-use-suest-for-margins-after-probit-or-regress Will appreciate your solution:)
Thank you. I tried your recommendation. Unfortunately, I could not find an organized document with examples for xlincom with margins. I tried the following code, but my problem is withdrawing the margins of the independent variable categories (1.lower_class and 1.upper_class) from the 2 separate mlogit reg after suest. I mean, how to define in the command that I want 1.lower class from model A and 1.lower_class from model B in the margins and in the xlincom. Please see my example below: mlogit owner_housing_debt2 ib0.lower_class ib0.upper_class if regime==1, baseoutcome(1) est store A mlogit owner_housing_debt2 ib0.lower_class ib0.upper_class if regime==2, baseoutcome(1) est store B suest A B margins 1.lower_class 1.upper_class, coeflegend post lincom _b[1.lower_class] - _b[1.upper_class]
Stata coefplot: plot coefficients and corresponding confidence intervals on 2nd axis
When trying to depict two coefficients from one regression on separate axes with Ben Jann's superb coefplot (ssc install coefplot) command, the coefficient to be shown on the 2nd axis is correctly displayed, but its confidence interval is depicted on the 1st scale. Can anyone explain how I get the CI displayed on the same (2nd) axis as the coefficient it belongs to? I couldn't find any option to change this - and imagine it should be the default, if not the only, option to plot the CI around the point estimate it belongs to. I use the latest coefplot version with Stata 16. Here is a minimum example to illustrate the problem: results plot webuse union, clear eststo results: reg idcode i.union grade coefplot (results, keep(1.union)) (results, keep(grade) xaxis(2))
In the line coefplot (results, keep(1.union)) (results, keep(grade) xaxis(2)) you specify the option xaxis(2), but this is not a documented option of coefplot, although it is a valid option of twoway rspike which is called by coefplot. Apparently, if you use xaxis(2) something goes wrong with the communication between coefplot and rspike. This works for me: coefplot (results, keep(1.union)) (results, keep(grade) axis(2))
I'm trying to create something similar. Since this option is not built-in we need to write a program to tweak how coefplot works. I'm sharing the code from the user manual here: http://repec.sowi.unibe.ch/stata/coefplot/markers.html capt program drop coefplot_mlbl *! version 1.0.0 10jun2021 Ben Jann program coefplot_mlbl, sclass _parse comma plots 0 : 0 syntax [, MLabel(passthru) * ] if `"`mlabel'"'=="" local mlabel mlabel(string(#b, "%5.2f") + " (" + string(#ll, "%5.2f") + "; " + string(#ul, "%5.2f") + ")") preserve qui coefplot `plots', `options' `mlabel' generate replace nodraw sreturn clear tempvar touse qui gen byte `touse' = __at<. mata: st_global("s(mlbl)", /// invtokens((strofreal(st_data(.,"__at","`touse'")) :+ " " :+ /// "`" :+ `"""' :+ st_sdata(.,"__mlbl","`touse'") :+ `"""' :+ "'")')) sreturn local plots `"`plots'"' sreturn local options `"`options'"' end capt program drop coefplot_ymlbl *! version 1.0.0 10jun2021 Ben Jann program coefplot_ymlbl _parse comma plots 0 : 0 syntax [, MLabel(str asis) * ] _parse comma mlspec mlopts : mlabel local mlopts = substr(`"`mlopts'"', 2, .) // remove leading comma if `"`mlspec'"'!="" local mlabel mlabel(`mlspec') else local mlabel coefplot_mlbl `plots', `options' `mlabel' coefplot `plots', /// yaxis(1 2) yscale(alt) yscale(axis(2) alt noline) /// ylabel(none, axis(2)) yti("", axis(2)) /// ymlabel(`s(mlbl)', axis(2) notick angle(0) `mlopts') `options' end coefplot_ymlbl D F, drop(_cons) xline(0) However, the above program does not allow for the option 'bylabel'. I get a stata error saying "bylabel not allowed". I wanted to ask if there is a way to edit this code and include the bylabel option which is used to label subplots?
Parsing text file into a Data Frame
I have a text file which has information, like so: product/productId: B000GKXY4S product/title: Crazy Shape Scissor Set product/price: unknown review/userId: A1QA985ULVCQOB review/profileName: Carleen M. Amadio "Lady Dragonfly" review/helpfulness: 2/2 review/score: 5.0 review/time: 1314057600 review/summary: Fun for adults too! review/text: I really enjoy these scissors for my inspiration books that I am making (like collage, but in books) and using these different textures these give is just wonderful, makes a great statement with the pictures and sayings. Want more, perfect for any need you have even for gifts as well. Pretty cool! product/productId: B000GKXY4S product/title: Crazy Shape Scissor Set product/price: unknown review/userId: ALCX2ELNHLQA7 review/profileName: Barbara review/helpfulness: 0/0 review/score: 5.0 review/time: 1328659200 review/summary: Making the cut! review/text: Looked all over in art supply and other stores for "crazy cutting" scissors for my 4-year old grandson. These are exactly what I was looking for - fun, very well made, metal rather than plastic blades (so they actually do a good job of cutting paper), safe ("blunt") ends, etc. (These really are for age 4 and up, not younger.) Very high quality. Very pleased with the product. I want to parse this into a dataframe with the productID, title, price.. as columns and the data as the rows. How can I do this in R?
A quick and dirty approach: mytable <- read.table(text=mytxt, sep = ":") mytable$id <- rep(1:2, each = 10) res <- reshape(mytable, direction = "wide", timevar = "V1", idvar = "id") There will be issues if there are other colons in the data. Also assumes that there is an equal number (10) of variables for each case. All
saving extracted statistic from regression in a dataset: Stata
I wonder if you could help me figure it out a quite simple question of how I can save an extracted statistic from a regression in a separate dataset (or file), and also add more statistics from the other regression to it later? For example, the statistic from one regression can be extracted as e(f) and from another one is also as e(f).
Roger Newson's parmest is great for dealing with "resulsets," which are Stata datasets created from the output of a Stata command. The help file has a nice example of combining three regressions into a single file that I modified here to include R^2 [stored in e(df_r)]: sysuse auto, clear tempfile tf1 tf2 tf3 parmby "reg price weight", lab saving(`"`tf1'"', replace) idnum(1) idstr(M1) escal(r2) parmby "reg price foreign", lab saving(`"`tf2'"', replace) idnum(2) idstr(M2) escal(r2) parmby "reg price weight foreign", lab saving(`"`tf3'"', replace) idnum(3) idstr(M3) escal(r2) drop _all append using `"`tf1'"' `"`tf2'"' `"`tf3'"' list idnum idstr es_1, noobs nodis
R - does failed RegEx pattern matching originate in file conversion or use of tm package?
As a relative novice in R and programming, my first ever question in this forum is about regex pattern matching, specifically line breaks. First some background. I am trying to perform some preprocessing on a corpus of texts using R before processing them further on the NLP platform GATE. I convert the original pdf files to text as follows (the text files, unfortunately, go into the same folder): dest <- "./MyFolderWithPDFfiles" myfiles <- list.files(path = dest, pattern = "pdf", full.names = TRUE) lapply(myfiles, function(i) system(paste('"C:/Program Files (x86)/xpdfbin-win-3.04/bin64/pdftotext.exe"', paste0('"', i, '"')), wait = FALSE)) Then, having loaded the tm package and physically(!) moved the text files to another folder, I create a corpus: TextFiles <- "./MyFolderWithTXTfiles" EU <- Corpus(DirSource(TextFiles)) I then want to perform a series of custom transformations to clean the texts. I succeeded to replace a simple string as follows: ReplaceText <- content_transformer(function(x, from, to) gsub(from, to, x, perl=T)) EU2 <- tm_map(EU, ReplaceText, "Table of contents", "TOC") However, a pattern that is a 1-3 digit page number followed by two line breaks and a page break is causing me problems. I want to replace it with a blank space: EU2 <- tm_map(EU, ReplaceText, "[0-9]{1,3}\n\n\f", " ") The ([0-9]{1,3}) and \f alone match. The line breaks don't. If I copy text from one of the original .txt files into the RegExr online tool and test the expression "[0-9]{1,3}\n\n\f", it matches. So the line breaks do exist in the original .txt file. But when I view one of the .txt files as read into the EU corpus in R, there appear to be no line breaks even though the lines are obviously breaking before the margin, e.g. [3] "PROGRESS TOWARDS ACCESSION" [4] "1" [5] "" [6] "\fTable of contents" Seeing this, I tried other patterns, e.g. to detect one or more blank space ("[0-9]{1,3}\s*\f"), but no patterns worked. So my questions are: Am I converting and reading the files into R correctly? If so, what has happened to the line breaks? If no line breaks is normal, how can I pattern match the character on line 5? Is that not a blank space? (A tangential concern:) When converting the pdf files, is there code that will put them directly in a new folder? Apologies for extending this, but how can one print or inspect only a few lines of the text object? The tm commands and head(EU) print the entire object, each a very long text. I know my problem(s) must appear simple and perhaps stupid, but one has to start somewhere and extensive searching has not revealed a source that explains comprehensively how to use RegExes to modify text objects in R. I am so frustrated and hope someone here will take pity and can help me. Thanks for any advice you can offer. Brigitte p.s. I think it's not possible to upload attachments in this forum, therefore, here is a link to one of the original PDF documents: http://ec.europa.eu/enlargement/archives/pdf/key_documents/1998/czech_en.pdf Because the doc is long, I created a snippet of the first 3 pages of the TXT doc, read it into the R corpus ('EU') and printed it to the console and this is it: dput(EU[[2]]) structure(list(content = c("REGULAR REPORT", "FROM THE COMMISSION ON", "CZECH REPUBLIC'S", "PROGRESS TOWARDS ACCESSION ***********************", "1", "", "\fTable of contents", "A. Introduction", "a) Preface The Context of the Progress Report", "b) Relations between the European Union and the Czech Republic The enhanced Pre-Accession Strategy Recent developments in bilateral relations", "B. Criteria for membership", "1. Political criteria", "1.1. Democracy and the Rule of Law Parliament The Executive The judicial system Anti-Corruption measures", "1.2. Human Rights and the Protection of Minorities Civil and Political Rights Economic, Social and Cultural Rights Minority Rights and the Protection of Minorities", "1.3. General evaluation", "2. Economic criteria", "2.1. Introduction 2.2. Economic developments since the Commission published its Opinion", "Macroeconomic developments Structural reforms 2.3. Assessment in terms of the Copenhagen criteria The existence of a functioning market economy The capacity to cope with competitive pressure and market forces 2.4. General evaluation", "3. Ability to assume the obligations of Membership", "3.1. Internal Market without frontiers General framework The Four Freedoms Competition", "3.2. Innovation Information Society Education, Training and Youth Research and Technological Development Telecommunications Audio-visual", "3.3. Economic and Fiscal Affairs Economic and Monetary Union", "2", "", "\fTaxation Statistics "), meta = structure(list(author = character(0), datetimestamp = structure(list(sec = 50.1142621040344, min = 33L, hour = 15L, mday = 3L, mon = 10L, year = 114L, wday = 1L, yday = 306L, isdst = 0L), .Names = c("sec", "min", "hour", "mday", "mon", "year", "wday", "yday", "isdst"), class = c("POSIXlt", "POSIXt"), tzone = "GMT"), description = character(0), heading = character(0), id = "CZ1998ProgressSnippet.txt", language = "en", origin = character(0)), .Names = c("author", "datetimestamp", "description", "heading", "id", "language", "origin"), class = "TextDocumentMeta")), .Names = c("content", "meta"), class = c("PlainTextDocument", "TextDocument"))
Yes, working with text in R is not always a smooth experience! But you can get a lot done quickly with some effort (maybe too much effort!) If you could share one of your PDF files or the output of dput(EU), that might help to identify exactly how to capture your page numbers with regex. That would also add a reproducible example to your question, which is an important thing to have in questions here so that people can test their answers and make sure they work for your specific problem. No need to put PDF and text files in separate folders, instead you can use a pattern like so: EU <- Corpus(DirSource(pattern = ".txt")) This will only read the text files and ignore the PDF files There is no 'snippet view' method in tm, which is annoying. I often use just names(EU) and EU[[1]] for quick looks UPDATE With the data you've just added, I'd suggest a slightly tangential approach. Do the regex work before passing the data to the tm package formats, like so: # get the PDF download.file("http://ec.europa.eu/enlargement/archives/pdf/key_documents/1998/czech_en.pdf", "my_pdf.pdf", method = "wget") # get the file name of the PDF myfiles <- list.files(path = getwd(), pattern = "pdf", full.names = TRUE) # convert to text (not my pdftotext is in a different location to you) lapply(myfiles, function(i) system(paste('"C:/Program Files/xpdf/bin64/pdftotext.exe"', paste0('"', i, '"')), wait = FALSE)) # read plain text int R x1 <- readLines("my_pdf.txt") # make into a single string x2 <- paste(x1, collapse = " ") # do some regex... x3 <- gsub("Table of contents", "TOC", x2) x4 <- gsub("[0-9]{1,3} \f", "", x3) # convert to corpus for text mining operations x5 <- Corpus(VectorSource(x4)) With the snippet of data your provided using dput, the output from this method is inspect(x5) <<VCorpus (documents: 1, metadata (corpus/indexed): 0/0)>> [[1]] <<PlainTextDocument (metadata: 7)>> REGULAR REPORT FROM THE COMMISSION ON CZECH REPUBLIC'S PROGRESS TOWARDS ACCESSION *********************** TOC A. Introduction a) Preface The Context of the Progress Report b) Relations between the European Union and the Czech Republic The enhanced Pre-Accession Strategy Recent developments in bilateral relations B. Criteria for membership 1. Political criteria 1.1. Democracy and the Rule of Law Parliament The Executive The judicial system Anti-Corruption measures 1.2. Human Rights and the Protection of Minorities Civil and Political Rights Economic, Social and Cultural Rights Minority Rights and the Protection of Minorities 1.3. General evaluation 2. Economic criteria 2.1. Introduction 2.2. Economic developments since the Commission published its Opinion Macroeconomic developments Structural reforms 2.3. Assessment in terms of the Copenhagen criteria The existence of a functioning market economy The capacity to cope with competitive pressure and market forces 2.4. General evaluation 3. Ability to assume the obligations of Membership 3.1. Internal Market without frontiers General framework The Four Freedoms Competition 3.2. Innovation Information Society Education, Training and Youth Research and Technological Development Telecommunications Audio-visual 3.3. Economic and Fiscal Affairs Economic and Monetary Union Taxation Statistics