Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • help exporting regression/margins results using outreg2 function

    Hi all,
    I have been struggling with this for a few days now, would really appreciate any help. I am quite new to stata but i have studied the help commands and dr google alot and i have not made much progress would really be very grateful for any tips

    i have a dataset with about 95 variables for my clinical study about prostate cancer and outcome at prostate biopsy, looking at specifically the association between cancer and a geentic score so i have incorporated those into my model and was looking at the marginal analyses results. no issues there. i cannot seem to be able to export anything using the outreg2 command, i have a lot of output i wish to include in my thesis and i have had to so far cope and paste it all into excel tables and reformat them then copy and paste back to my word doc, it is literally taking me hours and hours

    i created a word doc called 'statastuff' and closed it. i then type the below command,

    outreg2 using "C:\Users\hraghallaigh\Documents\statastuff.do cx", word replace
    C:\Users\hraghallaigh\Documents\statastuff.docx
    dir : seeout


    when i type the above command, i click on the doc link it generates which leads me to word, which says again and again it wont open the file as it is corrupted. i then try to go via the seeout route and same thing. i deleted the file and did it again, same thing. did the same with an excel file, ie make one called 'test' ran the command and same issue. does anyone know of any way I cn address this or another way i can export my results to a word doc?







  • #2
    outreg2 is a command, not a function. It can be installed from SSC (FAQ Advice #12). docx is not a supported format, hence the error. Therefore, save the file with the extension .doc or .rtf

    Code:
    outreg2 using "C:\Users\hraghallaigh\Documents\statastuff.doc", replace
    Last edited by Andrew Musau; 27 Aug 2020, 08:20.

    Comment


    • #3
      Andrew, it now works perfectly. bit embarrassing i didn't notice that apologies. this will help me so much thank you.

      Comment


      • #4
        Dear all,
        I need your help on how I would be able to export marginal effects ( both first differences and second differences) of interactions from Stata to word. I fit a logit model:
        svy: logit outcomvar i.v106_new i.v025 i.adolescent_age_F i.media_new i.husband_edu_new i.v190 i.region_f i.religion_f i.women_occupation i.husband_occupation i.wantedness_child i.birthor i.v106_new#i.v025 i.v106_new#i.adolescent_age_F i.v106_new#i.media_new i.v106_new#i.husband_edu_new i.v025#i.media_new i.v025#i.husband_edu_new i.v025#i.adolescent_age_F i.adolescent_age_F#i. husband_edu_new i.media_new#i.husband_edu_new i.v025#i.wantedness_child i.media_new#i.wantedness_child i.adolescent_age_F#i.wantedness_child i.v025#i.v106_new#i.media_new i.women_occupation i.husband_occupation i.wantedness_child i.birthor

        Then I do this

        margins v106_new#v025
        then this:
        margins v025, dydx (v106_new)
        Finally this:
        margins v025, dydx (v106_new) pwcompare (effects)
        Now I want to do these codes for all interacting variables (not just for the interaction between v025 and v106_new, but for all the interaction in my model) and export the result to word in tables. I want to export the
        dydx () of both first differences ( margins v025, dydx (v106_new) and second differences/ contrasts) (margins v025, dydx (v106_new) pwcompare (effects) for all interactions at once.

        Your help is much appreciated.

        Last edited by Gebretsadik Shibre; 21 Mar 2023, 06:04.

        Comment

        Working...
        X