I am currently working with a project using sdid, and I have create a lot of graphs, so I want to name then so that won't save the wring file. But I received error message when I add name in
here is the data example I am using:
here is the code to create the graph:
error message:
BTW is there anyway to refer someone to this post since I think this maybe a package issue
Code:
g1_opt and g2_opt
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input float l_wo str20 state float(date treat)
.01275459 "Alabama" 708 0
.011520036 "Alaska" 708 0
.035300113 "Arizona" 708 0
.2159022 "Arkansas" 708 0
.1027264 "Colorado" 708 0
.0489768 "Connecticut" 708 0
.15697438 "Delaware" 708 0
.018188603 "District Of Columbia" 708 0
.03771587 "Georgia" 708 0
.05964286 "Hawaii" 708 0
.3197141 "Idaho" 708 0
.0013805873 "Illinois" 708 0
.05026759 "Indiana" 708 0
.11582603 "Iowa" 708 0
.22474666 "Kansas" 708 0
.28713158 "Kentucky" 708 0
.06301742 "Louisiana" 708 0
.067864254 "Maine" 708 0
.05244083 "Maryland" 708 0
.034076143 "Massachusetts" 708 0
.05750446 "Michigan" 708 0
.04498312 "Minnesota" 708 0
.04272431 "Mississippi" 708 0
.070723325 "Missouri" 708 0
.19314577 "Montana" 708 0
.105719 "Nebraska" 708 0
.0274447 "Nevada" 708 0
.068513475 "New Hampshire" 708 0
.05449773 "New Jersey" 708 0
.06432614 "New Mexico" 708 0
.007014291 "New York" 708 0
.12009346 "North Carolina" 708 0
.3142583 "North Dakota" 708 0
.1293386 "Ohio" 708 0
.11382876 "Oklahoma" 708 0
.0560232 "Pennsylvania" 708 0
.04164732 "Rhode Island" 708 0
.14074685 "South Carolina" 708 0
.3005266 "South Dakota" 708 0
.2392258 "Tennessee" 708 0
.07614797 "Texas" 708 0
.25222397 "Utah" 708 0
.06212734 "Vermont" 708 0
.12496869 "Virginia" 708 0
.12030113 "West Virginia" 708 0
.11876343 "Wisconsin" 708 0
.04795944 "Wyoming" 708 0
.08281 "Oregon" 708 0
.013458432 "Alabama" 709 0
.004081066 "Alaska" 709 0
.02985763 "Arizona" 709 0
.19610216 "Arkansas" 709 0
.1004516 "Colorado" 709 0
.04750711 "Connecticut" 709 0
.12947008 "Delaware" 709 0
.035371087 "District Of Columbia" 709 0
.04029487 "Georgia" 709 0
.04455572 "Hawaii" 709 0
.27657288 "Idaho" 709 0
.0011834772 "Illinois" 709 0
.05590299 "Indiana" 709 0
.09012938 "Iowa" 709 0
.1921363 "Kansas" 709 0
.2640478 "Kentucky" 709 0
.064024724 "Louisiana" 709 0
.07029141 "Maine" 709 0
.05032292 "Maryland" 709 0
.030073125 "Massachusetts" 709 0
.05532732 "Michigan" 709 0
.04124705 "Minnesota" 709 0
.04513435 "Mississippi" 709 0
.068520755 "Missouri" 709 0
.14137082 "Montana" 709 0
.09401238 "Nebraska" 709 0
.020970695 "Nevada" 709 0
.065420754 "New Hampshire" 709 0
.05156455 "New Jersey" 709 0
.066556655 "New Mexico" 709 0
.008059656 "New York" 709 0
.10820007 "North Carolina" 709 0
.26325303 "North Dakota" 709 0
.12414164 "Ohio" 709 0
.10249893 "Oklahoma" 709 0
.0486827 "Pennsylvania" 709 0
.037104573 "Rhode Island" 709 0
.13144006 "South Carolina" 709 0
.28708246 "South Dakota" 709 0
.20212504 "Tennessee" 709 0
.06817195 "Texas" 709 0
.21855143 "Utah" 709 0
.05911095 "Vermont" 709 0
.11418428 "Virginia" 709 0
.11361136 "West Virginia" 709 0
.11302976 "Wisconsin" 709 0
.04878064 "Wyoming" 709 0
.071833216 "Oregon" 709 0
.013458432 "Alabama" 710 0
.008821355 "Alaska" 710 0
.032250665 "Arizona" 710 0
.2109553 "Arkansas" 710 0
end
format %tmCCYY/NN date
here is the code to create the graph:
Code:
sdid l_wo state date treat, vce(noinference) method(did) seed(1234) graph g1on ///
g1_opt(title("Oregon Crime Rate") subtitle(" (did)") ytitle("Difference in Outcome between treated and selected") xtitle("Selected Control State") name(g1_733, replace)) ///
g2_opt(yline(`y_mean', lp(dash) lc(black)) title("Oregon Crime Rate") subtitle("(did)") legend(position(6)) ytitle("Crime Rate in Log") note("Black dash line indicates the mean of outcome: `y_mean'") name(g2_733, replace))
Code:
. sdid l_wo state date treat, vce(noinference) method(did) seed(1234) graph g1on ///
> g1_opt(title("Oregon Crime Rate") subtitle(" (did)") ytitle("Difference in Outcome between treated and selected") xtitle("Selected Control State") name(g1_733, repla
> ce)) ///
> g2_opt(yline(`y_mean', lp(dash) lc(black)) title("Oregon Crime Rate") subtitle("(did)") legend(position(6)) ytitle("Crime Rate in Log") note("Black dash line indic
> ates the mean of outcome: `y_mean'") name(g2_733, replace))
Difference-in-Differences Estimator
-----------------------------------------------------------------------------
l_wo | ATT Std. Err. t P>|t| [95% Conf. Interval]
-------------+---------------------------------------------------------------
treat | -0.02302 . . . . .
-----------------------------------------------------------------------------
95% CIs and p-values are based on Large-Sample approximations.
option name() not allowed
