Announcement

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

  • way for exporting local variable to .csv file

    Dear Statalist users,

    I am struggling to find way for exporting local variable to .csv file.

    One way I found was 'putexcel' commend, but it does not work with message "workbook Kruger_replicate.csv could not be loaded".

    I think 'putexcel' works only for .xls file

    Is there any other way to paste value of local variable to csv file with stata commend?

    Please, give me your cool idea

    And here's my code

    foreach i of varlist d_sesk d_srace agek attrik nstud pscore {
    eststo: mvtest mean `i', by(cltypek)
    local pv`i'=round(r(p_F),0.01)
    }
    putexcel E2=(`pvd_sesk') E3=(`pvd_srace') E4=(`pvagek') E5=(`pvattrik') E6=(`pvnstud') E7=(`pvpscore') ///
    using Kruger_replicate, modify


  • #2
    The help for putexcel does make clear that it is restricted to .xls and .xlsx.

    I can't advise on better ways for your purpose, but note that

    Code:
    local pv`i'=round(r(p_F),0.01)
    would be better as

    Code:
    local pv`i': di %3.2f  r(p_F)
    given the facts revealed by reading items listed on

    Code:
    search precision
    Also, FWIW, see suggestions at http://www.stata.com/statalist/archi.../msg01258.html

    Comment


    • #3
      Thank you for your recommend I modified the code about rounding.

      As you said, if using putexcel is not possible, I wrote my code fully differently before.

      What I really want to do is to report P-value for joint mean difference test(F-test) with .csv file.

      I used 'eststo' and 'esttab' and here's my code :

      eststo : mvtest mean `i', by(cltypek)
      esttab pv_`i', cells("p(fmt(2))")

      The help for esttab is saying that it display formatted regression table... I think it is the reason why

      my code does not report P-value for mvtest.

      Could you tell me how can I make table reporting P-value for mvtest and export the table?

      Comment

      Working...
      X