{smcl} {* 11May2011}{...} {cmd:help me}: Scott's help file - 11May2011 {hline} {p2colset 4 17 17 2}{...} graph describe x-bubble1.gph {title:External links} {browse "http://www.stata.com/":Stata} {browse "http://www.stata-press.com/":Stata Press} {browse "http://www.sociolab.ethz.ch/people/jannb/estout/index.html":Jann's esttab} {helpb colorstyle:Colors} {helpb scatter##marker_options:Markers} {helpb linewidthstyle:Widths} {helpb linepatternstyle:lpattern} {title:Internal links} {help me##datasets:Datasets} {help me##:graphics:Graph commands} {help me##:macros:macro tools} {help me##margins:margins magic} {help me##quotes:Quotes processing} {help me##strings:String and format commands} {help me##svy:svy commands} {help me##updates:Updating Stata} {help me##:} {marker datasets} {title:Datasets ===============================================================} {help me##datasub:subdirectory} {marker datasub} {title:data subdirectory} use data\binlfp3.dta {marker graphics} {title:Graph commands =========================================================} {help me##Gtextsz:Text size} {help me##:Gcaption} {help me##:} {help me##:} {marker Gtextsz} {title:text sizes} zero minuscule tiny vsmall small medsmall medium medlarge large vlarge huge vhuge {marker Gcaption} {title:Graph caption} caption("# `tag'",size(vsmall)) caption("#3 wf7-matrix-plot.do jsl 2008-04-11",size(vsmall)) {marker macros} {title:macros tools ===========================================================} unab all : k5-inc // expand list into macro all local varlbl : variable label `x' local grandmn = string(`grandmn',"%11.3f") local nvars = wordcount("`vars'") local word2is = word("`vars'",2) local sd = el(r(sd),1,1) local b5 = el(r(b),1,5) {marker margins} {title:margins magic ==========================================================} {help me##marginslincom:lincom} {help me##:} {marker marginslincom} {title:margins lincom after margins, post} lincom (_b[2._at]-_b[1bn._at]) lincom (_b[2._at]-_b[1._at]) {marker strings} {title:String and format commands =============================================} local grandmn = string(`grandmn',"%11.3f") local gfmt = string(`gnum',"%02.0f") // adds leading zeros {marker svy} {title:svy commands ===========================================================} {title:svy and grab sd} svyset [pweight=kwgtr], strata(stratum) psu(secu) svy: mean `v' estat sd local sd = el(r(sd),1,1) {marker updates} {title:Updates ================================================================} {cmd:about} indicates when your version was born. {cmd:update all} updates the executeable. {cmd:adoupdate, update} {title:TODO ===================================================================} {title:Graph prediction with CI} graph twoway /// (rarea A_PrLB A_PrUB A_ageAT, color(gs14)) /// (connected A_Pr A_ageAT, msymbol(Oh) clcol(red) mcol(red)), /// title("Predictions with 95% CI") /// subtitle("Other variables held at their mean.") /// ytitle("Pr(LFP)") /// xlabel(20(10)60) ylabel(0(.2)1.0) legend(off) /// xtitle("Age") caption("#5 madd_margins01.do 2010-07-26",size(tiny)) updates SPost. {title:Distributions} Critical value z: invnormal(p) scalar `ztest' = r(estimate)/r(se) scalar `pztest' = 2*(1-normal(abs(`ztest'))) {title:missing} if !missing(v1,v2,...) if !missing(_all) {title:Master do-file} capture log close master log using wfmaster, name(master) replace text // program: wfmaster.do // task: Creating a master log file // project: workflow chapter 5 // author: jsl \ 2008-06-27 do x1.do do x2.do log close master {title:Graphs} {bf:s1manual}: BW with larger fonts for inclussion in paper. {bf:grids}: ylabel(0(.1).8, grid glpattern(shortdash) glcolor(gs10)) /// {bf:export}: graph export swb3-stat07a-OS3-orplot-white.png, width(1200) replace graph twoway (scatter y x, msymbol(dh) mcolor(black)) /// (scatteri y1 x), /// title("Large outlier that is not influential") /// legend(pos(6) order( 2 ) label(2 "Regression line") ) /// ytitle("y") xlabel( 0 1 2 3 4 5 ) {bf:dual axes labels}: Labels on left and right twoway (connect DP_DD X, yaxis(1) ytitle("Left1",axis(1))) /// (connect P_XD0 X, yaxis(2) ytitle("Right2",axis(2))) {title:Matrices} matrix rownames A = names matrix colnames A = names mat x5 = x[5,1...] mat colnames Xart = Xart svmat Xart, name(col) // will give variable name Xart not Xart1 nullmat(matname) forvalues i = 1/4 { mat v = (nullmat(v), `i') } The nullmat() function informs Stata that if v does not exist, the function row-join is to be generalized. Joining nothing with \ `i' results in (`i'). Thus the first time through the loop, v = (1) is formed. The second time through, v does exist, so v = (1,2) is formed, and so on. {title:text size size()} zero minuscule quarter_tiny third_tiny half_tiny tiny vsmall small medsmall medium medlarge large vlarge huge vhuge largest {title:line thickness} none vvthin thinnest vthin thin medthin medium medthick thick vthick vvthick vvvthick thickest relativesize {title:line thickness} solid dash dot dash_dot shortdash shortdash_dot longdash longdash_dot blank "formula" e.g., "-." or "--.." etc. l solid line _ (underscore) a long dash - (hyphen) a medium dash . short dash (almost a dot) # small amount of blank space {marker quotes} {title:quotes in a string} local textquote `"text(10 10 "dog", position(w))"' di `"`macval(textquote)'"' To return this from an ado file: return local textis `"`textquote'"' {title:long macros (not strings!)} return local ERcolNMS `"`ERcolNMS'"' {title:dataset and variable creation} label var "label" local tag "pub# truncated at 20 \ wf5-varnotes.do jsl 2008-04-09." note var: `tag' label data "Workflow data from Russian ISSP 2002 \ 2008-04-02" note: wf-isspru02.dta \ workflow ch 6 \ wf6-save.do jsl 2008-04-05 datasignature set datasignature set, reset quietly compress saveold mydata, replace {title:Useful options} sum ..., sep(0) recode..., gen() tab ..., gen() {p2colset 4 17 17 2}{...} {title:Author} {p 4 5 0} Scott Long's help me file.{p_end} {p 4 5 0} {browse "http://www.indiana.edu/~jslsoc/":My web site} {p_end}