Announcement

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

  • Export the name of treated and contolled groups from the datalist

    Hi there,
    I am using the following code to finalize some treated and controlled municipalities based on the infectious rate of covid . can you please guide me on what command provides me with the name of treated and controls in a nice table in Microsoft Word? My treated municipalities are shown in the "data browser" as 3 and my controlled ones are 0.

    forvalues i = 2020/2022 {
    qui su tot_inf_10k`i', de
    gen treated_`i' = 0 if tot_inf_10k`i' < r(p25)
    replace treated_`i' = 1 if tot_inf_10k`i' > r(p75)
    }
    gen treated = treated_2020 + treated_2021 + treated_2022

    drop if treated == . | treated == 1 | treated == 2

  • #2
    I find that asdoc from SSC is the most convenient command for this. You may also want to take a look at the premium version of the command, asdocx, from https://fintechprofessor.com/asdocx/.

    Code:
    preserve
    ssc install asdoc, replace
    keep if inlist(treated, 0, 3)
    contract municipalities treated
    gen status=cond(!treated, "Control","Treated")
    sort status municipalities
    asdoc list municipalities status, sep(0) replace
    restore
    where you replace "municipalities" in the code above with the name of your variable identifying municipalities.
    Last edited by Andrew Musau; 22 Feb 2023, 09:08.

    Comment


    • #3
      Worked nicely and clean,
      Thanks

      Comment

      Working...
      X