diff --git a/.gitignore b/.gitignore index 7e1671c0..f13b2f21 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,6 @@ _config.yml #the folder test/ is used for peoples individual testing, this is different from test_scripts/ test/ + +#Outputs in the run/outputs folder +run/output diff --git a/admin/checklist-submitting-SSC.md b/admin/checklist-submitting-SSC.md index 41ddeae3..882141fc 100644 --- a/admin/checklist-submitting-SSC.md +++ b/admin/checklist-submitting-SSC.md @@ -8,11 +8,11 @@ - [ ] 3.1 **Test in different operative systems** - This step is not necessary every time, but testing the commands in Stata on each of the PC, Mac and Linux operative systems should be done from time to time. A particularly good time to do this is after writing or editing code that depends on file paths, the console, special settings etc. If small updates are needed, then do them in the _version_ branch, otherwise do them in branches of the `develop` branch, merge those to `develop` and then re-merge `develop` to the version branch and test again. - [ ] 3.2 **Update version and date** - In the _version_ branch, update the version number and date in all ado-files and all dates in all help files. See section below for details. - [ ] 3.3 **Update version locals in ietoolkit** - In the _ietoolkit.ado_ file in the _version_ branch, update the _version_ and _versionDate_ locals at the top of the file. - - [ ] 3.4 **Update version in .pkg and .toc** - This has nothing to do with SSC but should be kept up to date to. This is for when people install directly through GitHub using `net install` - - [ ] 3.5 **Create a .zip file** - Create a .zip file with all ado-files and help files in the folder you just created in the archive folder. Then remove all files but the .zip file from the archive folder. -- [ ] 4. **Email Prof. Baum** - Email the .zip file created in step 3.4 to **kit.baum@bc.edu**. + - [ ] 3.4 **Update version in .pkg and .toc** - This has nothing to do with SSC but should be kept up to date to. This is for when people install directly through GitHub using `net install`. If any new command has been added, remember to add the files for that command to the `.pkg` file. + - [ ] 3.5 **Create a .zip file** - Create a .zip file with all ado-files and help files only. These files are not allowed to be in a sub-folder in this .zip file. No other files should be in this folder. Make a copy of this file in the archive folder of this package. +- [ ] 4. **Email Prof. Baum** - Email the .zip file created in step 3.5 to **kit.baum@bc.edu**. - [ ] 4.1 - If any commands are added or deleted, make note of that in the email. - - [ ] 4.2 - If any of the meta info (title, description, keywords, version or authour/contact) has changed then include those updates in your email. + - [ ] 4.2 - If any of the meta info (title, description, keywords, version or author/contact) has changed then include those updates in your email. - [ ] 5. **Draft release note** - Go to the [release notes](https://github.com/worldbank/ietoolkit/releases) and draft a new release note for the new version. Follow the format from previous releases with links to [issues](https://github.com/worldbank/ietoolkit/issues) solved. - [ ] 6. **Wait for publication confirmation** - Do not proceed pass this step until Prof. Baum has confirmed that the new version is uploaded to the servers. - [ ] 7. **Merge version branch to *master*** - If step 2 and 3 was done correctly, then there should not be any merge conflicts in this step. Once merged, delete the `version` branch. diff --git a/run/ie_recurse_rmdir.do b/run/ie_recurse_rmdir.do new file mode 100644 index 00000000..dd12bd6b --- /dev/null +++ b/run/ie_recurse_rmdir.do @@ -0,0 +1,67 @@ +* This file can delete all your folders on your computer if used incorrectly. + +cap program drop ie_recurse_rmdir + program define ie_recurse_rmdir + +qui { + syntax , folder(string) [DRYrun okifnotexist] + + /* + folder - full path to folder which should be deleted with all its content + dryrun - just list and do not delete all files that would have been deleted without this option + okifnotexist - it is ok that the top folder does not exist, do not throw erroe + + */ + + *Test that folder exist + mata : st_numscalar("r(dirExist)", direxists("`folder'")) + + if (`r(dirExist)' == 0) { + if missing("`okifnotexist'") { + noi di as error `"{phang}The folder used in [folder(`folder')] does not exist.{p_end}"' + error 693 + exit + } + else { + *Folder is missin and that is ok, just output a confirmation that it does not exists + noi di as result `"{phang}The folder used in [folder(`folder')] is already deleted.{p_end}"' + } + } + else { + + if (length("`folder'")<=10) { + noi di as error `"{phang}The folder used in [folder(`folder')] does not exist or you have not entered the full path.{p_end}"' + error 693 + exit + } + + * File paths can have both forward and/or back slash. We'll standardize them so they're easier to handle + local folderStd = subinstr(`"`folder'"',"\","/",.) + + *List files, directories and other files + local flist : dir `"`folderStd'"' files "*" , respectcase + local dlist : dir `"`folderStd'"' dirs "*" , respectcase + local olist : dir `"`folderStd'"' other "*" , respectcase + + *Use the command on each subfolder to this folder (if any) + foreach dir of local dlist { + *Recursive call on each subfolder + noi ie_recurse_rmdir , folder(`"`folderStd'/`dir'"') `automatic' `dryrun' + } + + *REmove all files + local files `"`flist' `olist'"' + foreach file of local files { + *If dryrun then list otherwise delete + if !missing("`dryrun'") noi di as result "{pstd}DRY RUN! Without option {bf:dryrun} file [`folderStd'/`file'] would have been deleted.{p_end}" + else rm `"`folderStd'/`file'"' + } + + * Remove this folder as it is now empty + if missing("`dryrun'") { + rmdir `"`folderStd'"' + noi di as result "{pstd}Folder [`folderStd'] and all its content were deleted.{p_end}" + } + } +} +end diff --git a/run/ieddtab.do b/run/ieddtab.do new file mode 100644 index 00000000..9935846d --- /dev/null +++ b/run/ieddtab.do @@ -0,0 +1,108 @@ + +/******************************************************************************* + Set up +*******************************************************************************/ + + * Set versson and seed + ieboilstart , version(13.1) + `r(version)' + set seed 313833 + + + * Add the path to your local clone of the [ietoolkit] repo + + global ietoolkit "C:\Users\wb462869\Documents\GitHub\ietoolkit" + qui do "${ietoolkit}/src/ado_files/ieddtab.ado" + + + * Load data blood pressure patient data + sysuse bplong, clear + + *Rename and recode time var + rename when time + recode time (1=0) (2=1) + + * Sort patient and time and randomize number on baseline value + bys patient : gen rand = runiform() if time == 0 + + *Sort rand and assign half of baseline to tmt == 1. + *Baseline is half of all obs, so half bseline = .25 + sort rand + gen tmt = (_n / _N > .25) if !missing(rand) + + *Sort on patient and time and copy baselin value to endline obs + sort patient time + by patient : replace tmt = tmt[_n-1] if time == 1 + + *Label vars. USe suffix -test to see what is dynamc and what is hard coded + label define treatment 0 "Control-test" 1 "Treatment-test" + label define time 0 "Baseline-test" 1 "Endline-test" + label value time time + label value tmt treatment + + + *Tidy up required vars + local orderkeep patient tmt time bp + keep `orderkeep' + order `orderkeep' + + + ************************************** + + *Utility function to test result matrix + program define test_matrix + syntax , rmatrix(string) row(string) col(string) expected_val(string) + local value = `rmatrix'["`row'","`col'"] + di "{pstd}Row: `row', Col: `col', Expected value: `expected_val', Actual value `value'{p_end}" + assert `value' == `expected_val' + end + + + + ************************************** + + *regular run, test all values + ieddtab bp, time(time) treat(tmt) + + mat result1 = r(ieddtabResults) + mat list result1 + + *Test second difference + test_matrix , rmatrix(result1) row("bp") col("2D") expected_val(-1.649999999999993) + test_matrix , rmatrix(result1) row("bp") col("2D_err") expected_val(3.332609384661584) + test_matrix , rmatrix(result1) row("bp") col("2D_stars") expected_val(0) + test_matrix , rmatrix(result1) row("bp") col("2D_N") expected_val(240) + + *Test control first difference + test_matrix , rmatrix(result1) row("bp") col("1DC") expected_val(-4.266666666666667) + test_matrix , rmatrix(result1) row("bp") col("1DC_err") expected_val(2.39864211429447) + test_matrix , rmatrix(result1) row("bp") col("1DC_stars") expected_val(1) + test_matrix , rmatrix(result1) row("bp") col("1DC_N") expected_val(120) + + *Test treatment first difference + test_matrix , rmatrix(result1) row("bp") col("1DT") expected_val(-5.916666666666667) + test_matrix , rmatrix(result1) row("bp") col("1DT_err") expected_val(2.313612179745651) + test_matrix , rmatrix(result1) row("bp") col("1DT_stars") expected_val(2) + test_matrix , rmatrix(result1) row("bp") col("1DT_N") expected_val(120) + + *Test control baseline summary stats + test_matrix , rmatrix(result1) row("bp") col("C0_mean") expected_val(156.0666666666667) + test_matrix , rmatrix(result1) row("bp") col("C0_err") expected_val(1.594458388227513) + test_matrix , rmatrix(result1) row("bp") col("C0_N") expected_val(60) + + *Test treatment baseline summary stats + test_matrix , rmatrix(result1) row("bp") col("T0_mean") expected_val(156.8333333333333) + test_matrix , rmatrix(result1) row("bp") col("T0_err") expected_val(1.346719526847542) + test_matrix , rmatrix(result1) row("bp") col("T0_N") expected_val(60) + + *Test control endline summary stats + test_matrix , rmatrix(result1) row("bp") col("C1_mean") expected_val(151.8) + test_matrix , rmatrix(result1) row("bp") col("C1_err") expected_val(1.791978359433497) + test_matrix , rmatrix(result1) row("bp") col("C1_N") expected_val(60) + + *Test treatment endline summary stats + test_matrix , rmatrix(result1) row("bp") col("T1_mean") expected_val(150.9166666666667) + test_matrix , rmatrix(result1) row("bp") col("T1_err") expected_val(1.881262298105969) + test_matrix , rmatrix(result1) row("bp") col("T1_N") expected_val(60) + + \ No newline at end of file diff --git a/run/iegitaddmd.do b/run/iegitaddmd.do index b4c1df74..d829ff35 100644 --- a/run/iegitaddmd.do +++ b/run/iegitaddmd.do @@ -1,11 +1,21 @@ * Set this local to a folder where folders can be creaetd for this experiment - global test_folder "" + global ietoolkit_clone "C:\Users\wb462869\Documents\GitHub\ietoolkit" + global test_folder "${ietoolkit_clone}\run\output\iegitaddmd" + + qui do "${ietoolkit_clone}/run/ie_recurse_rmdir.do" + + * Make sure this folder is created + cap mkdir "${ietoolkit_clone}\run\output\iegitaddmd" - * Create a folder clone and a folder dropbox (see use case 2 in help file for why both these folders are needed) - mkdir "${test_folder}/clone" - mkdir "${test_folder}/dropbox" + * Create a folder clone and a folder dropbox (see use case 2 in help file for why both these folders are needed) + local highlevel_folders clone dropbox gitfilter1 gitfilter2 + foreach folder of local highlevel_folders { + ie_recurse_rmdir, folder("${test_folder}/`folder'") okifnotexist + mkdir "${test_folder}/`folder'" + } + * USe iefolder to create identical project folders iefolder new project , projectfolder("${test_folder}/clone") iefolder new project , projectfolder("${test_folder}/dropbox") @@ -23,8 +33,24 @@ rmdir "${test_folder}/clone/DataWork/Baseline/DataSets" rmdir "${test_folder}/clone/DataWork/Baseline/Questionnaire/Questionnaire Documentation" + * Create the git folder + local gitfolders gitfilter1 gitfilter2 + foreach gitfolder of local gitfolders { + mkdir "${test_folder}/`gitfolder'/.git" + mkdir "${test_folder}/`gitfolder'/includeme" + mkdir "${test_folder}/`gitfolder'/skipmein2" + mkdir "${test_folder}/`gitfolder'/skipalsomein2" + mkdir "${test_folder}/`gitfolder'/sub" + mkdir "${test_folder}/`gitfolder'/sub/.git" + mkdir "${test_folder}/`gitfolder'/sub/includealsome" + + mkdir "${test_folder}/`gitfolder'/ado" + mkdir "${test_folder}/`gitfolder'/asdfasd" + mkdir "${test_folder}/`gitfolder'/asdfasd/ado" + } + + *Set global to ietoolkit clone - global ietoolkit_clone "" qui do "${ietoolkit_clone}/src/ado_files/iegitaddmd.ado" *Use case 1 - see helpfile for description of use cases @@ -32,9 +58,21 @@ iegitaddmd , folder("${test_folder}/clone/DataWork") auto *Use case 2 - see helpfile for description of use cases - iegitaddmd , folder("${test_folder}/clone/DataWork") comparefolder("${test_folder}/dropbox/DataWork") auto dryrun - iegitaddmd , folder("${test_folder}/clone/DataWork") comparefolder("${test_folder}/dropbox/DataWork") auto + iegitaddmd , folder("${test_folder}/clone\DataWork") comparefolder("${test_folder}/dropbox\DataWork") auto dryrun + iegitaddmd , folder("${test_folder}/clone\DataWork") comparefolder("${test_folder}/dropbox\DataWork") auto *Test prompt mkdir "${test_folder}/clone/DataWork/Baseline/DataSets/Final/Publishable" - iegitaddmd , folder("${test_folder}/clone/DataWork") \ No newline at end of file + *iegitaddmd , folder("${test_folder}/clone/DataWork") + + *Test skip git folders + iegitaddmd , folder("${test_folder}/gitfilter1") auto + + *Test skip custom + iegitaddmd , folder("${test_folder}/gitfilter2") auto dry skipfolders(skipmein2 skipalsomein2 folderthatnotexist ado) + iegitaddmd , folder("${test_folder}/gitfilter2") auto skipfolders(skipmein2 skipalsomein2 folderthatnotexist ado) + + * Test that folders are not used + cap iegitaddmd , folder("${test_folder}/gitfilter2") auto skipfolders(skipmein2 skipalsomein2 folderthatnotexist asdfasd/ado) + assert _rc == 198 + \ No newline at end of file diff --git a/src/ado_files/iebaltab.ado b/src/ado_files/iebaltab.ado index 7281b7a5..058c17f9 100644 --- a/src/ado_files/iebaltab.ado +++ b/src/ado_files/iebaltab.ado @@ -1,4 +1,4 @@ -*! version 6.3 5NOV2019 DIME Analytics dimeanalytics@worldbank.org +*! version 6.4 11JAN2022 DIME Analytics dimeanalytics@worldbank.org capture program drop iebaltab program iebaltab diff --git a/src/ado_files/ieboilsave.ado b/src/ado_files/ieboilsave.ado index a8045f9e..be56d3f5 100644 --- a/src/ado_files/ieboilsave.ado +++ b/src/ado_files/ieboilsave.ado @@ -1,4 +1,4 @@ -*! version 6.3 5NOV2019 DIME Analytics dimeanalytics@worldbank.org +*! version 6.4 11JAN2022 DIME Analytics dimeanalytics@worldbank.org capture program drop ieboilsave program ieboilsave , rclass diff --git a/src/ado_files/ieboilstart.ado b/src/ado_files/ieboilstart.ado index 53d00b47..a697b0e1 100644 --- a/src/ado_files/ieboilstart.ado +++ b/src/ado_files/ieboilstart.ado @@ -1,4 +1,4 @@ -*! version 6.3 5NOV2019 DIME Analytics dimeanalytics@worldbank.org +*! version 6.4 11JAN2022 DIME Analytics dimeanalytics@worldbank.org capture program drop ieboilstart program ieboilstart , rclass @@ -16,7 +16,8 @@ *********************************/ - local stata_versions "11 11.0 11.1 11.2 12 12.0 12.1 13 13.0 13.1 14 14.0 14.1 14.2 15 15.0 15.1" + * Based on versions listed here: https://www.stata.com/support/faqs/resources/history-of-stata/ + local stata_versions "11 11.0 11.1 11.2 12 12.0 12.1 13 13.0 13.1 14 14.0 14.1 14.2 15 15.0 15.1 16.0 16.1 17.0" if `:list versionnumber in stata_versions' == 0 { diff --git a/src/ado_files/ieddtab.ado b/src/ado_files/ieddtab.ado index 2dd7fecf..11cde152 100644 --- a/src/ado_files/ieddtab.ado +++ b/src/ado_files/ieddtab.ado @@ -1,4 +1,4 @@ -*! version 6.3 5NOV2019 DIME Analytics dimeanalytics@worldbank.org +*! version 6.4 11JAN2022 DIME Analytics dimeanalytics@worldbank.org cap program drop ieddtab program define ieddtab, rclass @@ -676,7 +676,7 @@ cap program drop templateResultMatrix local basicMean_C1_cols C1_mean C1_err C1_N C1_clus local basicMean_T1_cols T1_mean T1_err T1_N T1_clus - local colnames `2ndDiff_cols' `1stDiff_C_cols' `1stDiff_T_cols' `basicMean_C0_cols' `basicMean_T0_cols' `basicMean_C1_cols' `basicMean_T0_cols' + local colnames `2ndDiff_cols' `1stDiff_C_cols' `1stDiff_T_cols' `basicMean_C0_cols' `basicMean_T0_cols' `basicMean_C1_cols' `basicMean_T1_cols' *Define default row here. The results for each var will be one row that starts with all missing vlaues mat startRow = (.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.) diff --git a/src/ado_files/iedropone.ado b/src/ado_files/iedropone.ado index 0d3ac2f0..336d049e 100644 --- a/src/ado_files/iedropone.ado +++ b/src/ado_files/iedropone.ado @@ -1,4 +1,4 @@ -*! version 6.3 5NOV2019 DIME Analytics dimeanalytics@worldbank.org +*! version 6.4 11JAN2022 DIME Analytics dimeanalytics@worldbank.org capture program drop iedropone program define iedropone , diff --git a/src/ado_files/iefolder.ado b/src/ado_files/iefolder.ado index 9d3e134a..412f8508 100644 --- a/src/ado_files/iefolder.ado +++ b/src/ado_files/iefolder.ado @@ -1,4 +1,4 @@ -*! version 6.3 5NOV2019 DIME Analytics dimeanalytics@worldbank.org +*! version 6.4 11JAN2022 DIME Analytics dimeanalytics@worldbank.org cap program drop iefolder program define iefolder @@ -899,7 +899,7 @@ cap program drop mdofle_p0 file write `subHandle' /// _col(4)"*Install all packages that this project requires:" _n /// _col(4)"*(Note that this never updates outdated versions of already installed commands, to update commands use adoupdate)" _n /// - _col(4)"local user_commands ietoolkit" _col(40) "//Fill this list will all user-written commands this project requires" _n /// + _col(4)"local user_commands ietoolkit iefieldkit" _col(40) "//Fill this list will all user-written commands this project requires" _n /// _col(4)"foreach command of local user_commands {" _n /// _col(8) "cap which " _char(96) "command'" _n /// _col(8) "if _rc == 111 {" _n /// diff --git a/src/ado_files/iegitaddmd.ado b/src/ado_files/iegitaddmd.ado index 44a8f505..1e52e71f 100644 --- a/src/ado_files/iegitaddmd.ado +++ b/src/ado_files/iegitaddmd.ado @@ -1,10 +1,10 @@ -*! version 6.3 5NOV2019 DIME Analytics dimeanalytics@worldbank.org +*! version 6.4 11JAN2022 DIME Analytics dimeanalytics@worldbank.org cap program drop iegitaddmd program define iegitaddmd qui { - syntax , folder(string) [comparefolder(string) customfile(string) all skip replace AUTOmatic DRYrun] + syntax , folder(string) [comparefolder(string) customfile(string) all skip replace AUTOmatic DRYrun skipfolders(string)] /****************************** ******************************* @@ -45,10 +45,10 @@ qui { local comparefolderStd = subinstr(`"`comparefolder'"',"\","/",.) *Get the name of the last folder in both folder() and comparefolder() - local thisLastSlash = strpos(strreverse(`"`folder'"'),"/") - local thisFolder = substr(`"`folder'"', (-1 * `thisLastSlash')+1 ,.) - local compLastSlash = strpos(strreverse(`"`comparefolder'"'),"/") - local compFolder = substr(`"`comparefolder'"', (-1 * `compLastSlash')+1 ,.) + local thisLastSlash = strpos(strreverse(`"`folderStd'"'),"/") + local thisFolder = substr(`"`folderStd'"', (-1 * `thisLastSlash')+1 ,.) + local compLastSlash = strpos(strreverse(`"`comparefolderStd'"'),"/") + local compFolder = substr(`"`comparefolderStd'"', (-1 * `compLastSlash')+1 ,.) *The last folder name should always be the same for folder() and * comparefolder() otherwise there it is likely that the to paths @@ -110,6 +110,25 @@ qui { exit } + * Test that paths are not used in skip folder. I.e. no slashes are used + local anyslash = strpos("`skipfolders'","/") + strpos("`skipfolders'","\") + if `anyslash' { + noi di as error `"{phang}The options [skipfolders(`skipfolders')] may not include forward or backward slashes, i.e., it may not include paths. Only folder names are accepted.{p_end}"' + error 198 + exit + } + + * Test that paths are not used in skip folder. I.e. no slashes are used + local anywildcard = strpos("`skipfolders'","*") + strpos("`skipfolders'","?") + if `anywildcard' { + noi di as error `"{phang}Wild cards like * and ? are not supported in the [skipfolders(`skipfolders')] option. While they are valid characters in folder names in Linux and Mac systems, they are not allowed in Windows system and are therefore not accepted in foldernames in this command.may not include forward or backward slashes, i.e. may not include paths. Only folder names.{p_end}"' + error 198 + exit + } + + *Add .git folder to folders to be skipped + local skipfolders `skipfolders' ".git" + /****************************** ******************************* List Files and folders @@ -137,8 +156,14 @@ qui { *Use the command on each subfolder to this folder (if any) foreach dir of local dlist { - *Recursive call on each subfolder - noi iegitaddmd , folder(`"`folderStd'/`dir'"') `all' `customFileRecurse' `skip' `replace' `automatic' `dryrun' + *Test if directory is in + if `:list dir in skipfolders' { + noi di as result "{pstd}SKIPPED: Folder [`folder'/`dir'] is skipped. See option skipvars() in {help iegitaddmd}.{p_end}" + } + else { + *Recursive call on each subfolder + noi iegitaddmd , folder(`"`folderStd'/`dir'"') `all' `customFileRecurse' `skip' `replace' `automatic' `dryrun' skipfolders(`skipfolders') + } } ****************************** @@ -212,10 +237,13 @@ qui { } } - *Recursivley do the same call on all sub-folders - foreach dir of local dlist { + *When using the comparfolder() option, only recurse over files that exist in + *both folder() and comparefolder(). Folders only in folder() are not relevant + *when comapring. And folders only in comaprefolder() have already been addressed. + local in_both_dlists : list comp_dlist & dlist + foreach dir of local in_both_dlists { *Recursive call on each subfolder - noi iegitaddmd , folder(`"`folderStd'/`dir'"') comparefolder(`"`comparefolder'/`dir'"') `customFileRecurse' `automatic' `dryrun' + noi iegitaddmd , folder(`"`folderStd'/`dir'"') comparefolder(`"`comparefolder'/`dir'"') `customFileRecurse' `automatic' `dryrun' skipfolders(`skipfolders') } } } @@ -234,7 +262,7 @@ qui { local createfile "" *Create message to show in dryrun mode - if !missing("`dryrun'") local dryrun_prompt " NO FILE WILL BE CREAETED AS OPTION {bf:dryrun} IS USED!" + if !missing("`dryrun'") local dryrun_prompt " NO FILE WILL BE CREATED AS OPTION {bf:dryrun} IS USED!" *If manual was used, get manual confirmation for each file if missing("`automatic'") { diff --git a/src/ado_files/iegraph.ado b/src/ado_files/iegraph.ado index ca612244..2943d52d 100644 --- a/src/ado_files/iegraph.ado +++ b/src/ado_files/iegraph.ado @@ -1,4 +1,4 @@ -*! version 6.3 5NOV2019 DIME Analytics dimeanalytics@worldbank.org +*! version 6.4 11JAN2022 DIME Analytics dimeanalytics@worldbank.org cap program drop iegraph program define iegraph, rclass diff --git a/src/ado_files/iekdensity.ado b/src/ado_files/iekdensity.ado index 810d65e1..a7649de6 100644 --- a/src/ado_files/iekdensity.ado +++ b/src/ado_files/iekdensity.ado @@ -1,4 +1,4 @@ -*! version 6.3 5NOV2019 DIME Analytics dimeanalytics@worldbank.org +*! version 6.4 11JAN2022 DIME Analytics dimeanalytics@worldbank.org cap prog drop iekdensity prog define iekdensity diff --git a/src/ado_files/iematch.ado b/src/ado_files/iematch.ado index 233d4f8f..373812be 100644 --- a/src/ado_files/iematch.ado +++ b/src/ado_files/iematch.ado @@ -1,4 +1,4 @@ -*! version 6.3 5NOV2019 DIME Analytics dimeanalytics@worldbank.org +*! version 6.4 11JAN2022 DIME Analytics dimeanalytics@worldbank.org cap program drop iematch program define iematch diff --git a/src/ado_files/ietoolkit.ado b/src/ado_files/ietoolkit.ado index 899a512b..fa0827f2 100644 --- a/src/ado_files/ietoolkit.ado +++ b/src/ado_files/ietoolkit.ado @@ -1,11 +1,11 @@ -*! version 6.3 5NOV2019 DIME Analytics dimeanalytics@worldbank.org +*! version 6.4 11JAN2022 DIME Analytics dimeanalytics@worldbank.org capture program drop ietoolkit program ietoolkit, rclass * UPDATE THESE LOCALS FOR EACH NEW VERSION PUBLISHED - local version "6.3" - local versionDate "5NOV2019" + local version "6.4" + local versionDate "11JAN2022" syntax [anything] diff --git a/src/help_files/iebaltab.sthlp b/src/help_files/iebaltab.sthlp index fd452382..aac60fae 100644 --- a/src/help_files/iebaltab.sthlp +++ b/src/help_files/iebaltab.sthlp @@ -1,5 +1,5 @@ {smcl} -{* 5 Nov 2019}{...} +{* 11 Jan 2022}{...} {hline} help for {hi:iebaltab} {hline} @@ -22,8 +22,8 @@ command please see the {browse "https://dimewiki.worldbank.org/wiki/Iebaltab":DI {it: {help iebaltab##displayoptioins:display_options} {help iebaltab##exportoptions:export_options}} ] -{phang2}where {it:balancevarlist} is one or several variables (from here on called balance variables) for which the command -will test for differences across the catagories in grpvar({it:varname}). +{phang2}where {it:balancevarlist} is one or several continuous or binary variables (from here on called balance variables) for which the command +will test for differences across the categories in grpvar({it:varname}). See note on non-binary categorical balance variables in the description section below. {marker opts}{...} {synoptset 23}{...} @@ -105,10 +105,10 @@ will test for differences across the catagories in grpvar({it:varname}). {title:Description} {pstd}{cmdab:iebaltab} is a command that generates balance tables (difference-in-means tables). - The command tests for statistically significant difference between the categories defined in the - grpvar(varname). The command can either test one control group against all other groups or test - all groups against each other. The command also allows for fixed effects, covariates and different - types of variance estimators. + The command tests for statistically significant difference in the balance variables between + the categories defined in the grpvar(varname). The command can either test one control group + against all other groups or test all groups against each other. The command also allows for + fixed effects, covariates and different types of variance estimators. {pstd}A lot of attention has also been spent on providing helpful error messages when the command is misspecified. The command will also issue errors or warnings when the command is specified @@ -118,6 +118,18 @@ will test for differences across the catagories in grpvar({it:varname}). This command will throw an error unless the user specify the option that suppresses that error or if the user specify any of the options that tells the command how to interpret missing values. +{pstd}The balance variables must all be continuous or binary variables. +Categorical variables (for example 1=single, 2=married, 3=divorced) should not be used as a balance variables, +since t-testing would inappropriately compare the mean of the underlying codes, which are not intended as numerical values. +Categorical variables must first be made into multiple binary dummy variables, +where each dummy represents one category in the categorical variable, +and the dummy is 1 if that category was used for that observation. +t-tests will be used to test differences in balance variables +regardless if the balance variable is continuous or binary, +even though that is not the most efficient test for binary variables. +See the command {stata ssc describe table1:table1} for a command that handles categorical variables + and allows you to test differences using other tests than t-tests. + {pstd}The command also attaches notes to the bottom of the table with information on, for example, which significance levels are used for stars, which fixed effects or covariates that were included (if any) etc. diff --git a/src/help_files/ieboilsave.sthlp b/src/help_files/ieboilsave.sthlp index 968e93ba..4cfb493d 100644 --- a/src/help_files/ieboilsave.sthlp +++ b/src/help_files/ieboilsave.sthlp @@ -1,5 +1,5 @@ {smcl} -{* 5 Nov 2019}{...} +{* 11 Jan 2022}{...} {hline} help for {hi:ieboilsave} {hline} diff --git a/src/help_files/ieboilstart.sthlp b/src/help_files/ieboilstart.sthlp index 8a73a2a7..91034067 100644 --- a/src/help_files/ieboilstart.sthlp +++ b/src/help_files/ieboilstart.sthlp @@ -1,5 +1,5 @@ {smcl} -{* 5 Nov 2019}{...} +{* 11 Jan 2022}{...} {hline} help for {hi:ieboilstart} {hline} diff --git a/src/help_files/ieddtab.sthlp b/src/help_files/ieddtab.sthlp index 268f5f00..b2bb0ee2 100644 --- a/src/help_files/ieddtab.sthlp +++ b/src/help_files/ieddtab.sthlp @@ -1,5 +1,5 @@ {smcl} -{* 5 Nov 2019}{...} +{* 11 Jan 2022}{...} {hline} help for {hi:ieddtab} {hline} diff --git a/src/help_files/iedropone.sthlp b/src/help_files/iedropone.sthlp index eba00758..19e6f9a0 100644 --- a/src/help_files/iedropone.sthlp +++ b/src/help_files/iedropone.sthlp @@ -1,5 +1,5 @@ {smcl} -{* 5 Nov 2019}{...} +{* 11 Jan 2022}{...} {hline} help for {hi:iedropone} {hline} diff --git a/src/help_files/iefolder.sthlp b/src/help_files/iefolder.sthlp index 74f10f7f..723f3dfd 100644 --- a/src/help_files/iefolder.sthlp +++ b/src/help_files/iefolder.sthlp @@ -1,5 +1,5 @@ {smcl} -{* 5 Nov 2019}{...} +{* 11 Jan 2022}{...} {hline} help for {hi:iefolder} {hline} diff --git a/src/help_files/iegitaddmd.sthlp b/src/help_files/iegitaddmd.sthlp index bcd51be1..5d8849c8 100644 --- a/src/help_files/iegitaddmd.sthlp +++ b/src/help_files/iegitaddmd.sthlp @@ -1,5 +1,5 @@ {smcl} -{* 5 Nov 2019}{...} +{* 11 Jan 2022}{...} {hline} help for {hi:iegitaddmd} {hline} @@ -13,18 +13,19 @@ command please see the {browse "https://dimewiki.worldbank.org/wiki/Iegitaddmd": {title:Syntax} -{phang} {cmdab:iegitaddmd} , {opt folder(file_path)} [{opt comparefolder(file_path)} {cmd:customfile(}{it:{help filename}}{cmd:)} {opt all} {opt skip} {opt replace} {opt auto:matic} {opt dry:run}] +{phang} {cmdab:iegitaddmd} , {opt folder(full_file_path)} [{opt comparefolder(full_file_path)} {cmd:customfile(}{it:{help filename}}{cmd:)} {opt all} {opt skip} {opt replace} {opt skipfolders(folder_name)} {opt auto:matic} {opt dry:run}] {marker opts}{...} -{synoptset 23}{...} +{synoptset 28}{...} {synopthdr:options} {synoptline} -{synopt :{opt folder(file_path)}}Specifies the folder path to the project folder clone where placeholder files will be created{p_end} -{synopt :{opt comparefolder(file_path)}}Specifies the top folder of a folder tree to be compared with {opt folder()}{p_end} +{synopt :{opt folder(full_file_path)}}Specifies the folder path to the project folder clone where placeholder files will be created{p_end} +{synopt :{opt comparefolder(full_file_path)}}Specifies the top folder of a folder tree to be compared with {opt folder()}{p_end} {synopt :{cmd:customfile(}{it:{help filename}}{cmd:)}}Specifies a file saved on disk that is used instead of the default file as placeholder{p_end} {synopt :{cmd:all}}Creates the placeholder file in every subfolder of {opt folder()}, whether empty or not{p_end} {synopt :{opt skip}}If option {opt all} is used and a folder has a file with same name as placeholder file, then nothing is done{p_end} {synopt :{opt replace}}If option {opt all} is used and a folder has a file with same name as placeholder file, then the file is overwritten{p_end} +{synopt :{opt skipfolders(folder_name)}}List of folders to be skipped. The folder {it:.git} is always added to this list, even when option is not used{p_end} {synopt :{opt auto:matic}}Makes the command create placeholder files without prompting the user for each file{p_end} {synopt :{opt dry:run}}Makes the command list all the files that would have been created without this option.{p_end} {synoptline} @@ -74,13 +75,32 @@ command please see the {browse "https://dimewiki.worldbank.org/wiki/Iegitaddmd": If {opt replace} is used then the file with the same name is overwritten with the new placeholder file before the command proceeds to the next folder.{p_end} -{phang}{opt auto:matic} can be used to speed up the creation of placeholders by telling the command to not prompt the users for confirmation for each file before it is created. The default is that the command is asking the user before creating each place holder file. This option should only be used when you are confident you have specified the correct folder paths. We recommend that you use the {opt dryrun} with this option to make sure that the folder paths are correct.{p_end} - -{phang}{opt dry:run} can be used to safely test that the folder paths are specified correctly before any placeholder files are created. When this option it used the command simply lists the file that would have been created if this option were not used. Once you are confident that list is correct, you can remove this option and re-run the command and the files will be created.{p_end} +{phang}{opt skipfolders(folder_name)} can be used to tell {cmd:iegitaddmd} which folders +in which a placeholder file should never be created. The best example of this is the {it:.git} +folder in which placeholders never should be created. That name is always skipped regardless of +this option being used or not. Use this option to list additional folders to be skipped. You +should not list the full folder path in this option, just the folder name. All folders with +that name will be skipped regardless of their location in the project folder. +Any sub-folder of these folders will also be skipped. The folder names may +be listed with or without quotation marks as long as there are no spaces in the names. If any of +the folder names has spaces, then quotation marks must be used for all folder names. + +{phang}{opt auto:matic} can be used to speed up the creation of placeholders by telling the +command to not prompt the users for confirmation for each file before it is created. The +default is that the command is asking the user before creating each place holder file. +This option should only be used when you are confident you have specified the correct folder +paths. We recommend that you use the {opt dryrun} with this option to make sure that the +folder paths are correct.{p_end} + +{phang}{opt dry:run} can be used to safely test that the folder paths are specified correctly +before any placeholder files are created. When this option it used the command simply lists +the file that would have been created if this option were not used. Once you are confident +that list is correct, you can remove this option and re-run the command and the files will +be created.{p_end} {title:Example} -{pstd}{inp:global github_folder "C:\Users\JohnSmith\Documents\GitHub\ProjectA"}{break}{inp:iegitaddmd , folder({it:"$github_folder"})}{p_end} +{pstd}{inp:global github_folder "C:/Users/JohnSmith/Documents/GitHub/ProjectA"}{break}{inp:iegitaddmd , folder({it:"$github_folder"})}{p_end} {pstd}In the example above, there is a GitHub repository in the folder ProjectA. This repository has a folder structure where some folders are still empty but will later @@ -88,16 +108,19 @@ command please see the {browse "https://dimewiki.worldbank.org/wiki/Iegitaddmd": collaborators' cloned local copies of the repository, the folders need to contain at least one file, which is being created by the command.{p_end} -{title:Acknowledgements} +{pstd}{inp:global github_folder "C:/Users/JohnSmith/Documents/GitHub/ProjectB"}{break}{inp:iegitaddmd , folder({it:"$github_folder"}) skipfolders("foo" "bar")}{p_end} -{pstd}I would like to acknowledge the help in testing and proofreading I received in relation to this command and help file from (in alphabetic order):{p_end} -{pmore}Guadalupe Bedoya{break}Luiza Cardoso de Andrade{break}Mrijan Rimal{break}Benjamin Daniels{break} +{pstd}In the example above, there is a GitHub repository in the folder ProjectB. This +is a project similar to ProjectA above but it has to folder, called {inp:foo} and {inp:bar} +in which no placeholder files should ever be created in. Any subfolders in {inp:foo} +or {inp:bar} will be skipped as well. The folder {inp:.git} is a system folder in git +repositories and will always be skipped.{p_end} {title:Author} {phang}All commands in ietoolkit is developed by DIME Analytics at DECIE, The World Bank's unit for Development Impact Evaluations. -{phang}Main author: Kristoffer Bjarkefur, DIME Analytics, The World Bank Group +{phang}Author: DIME Analytics, The World Bank Group {phang}Please send bug-reports, suggestions and requests for clarifications writing "ietoolkit iegitaddmd" in the subject line to:{break} diff --git a/src/help_files/iegraph.sthlp b/src/help_files/iegraph.sthlp index c1a9fb5d..736c8c6b 100644 --- a/src/help_files/iegraph.sthlp +++ b/src/help_files/iegraph.sthlp @@ -1,5 +1,5 @@ {smcl} -{* 5 Nov 2019}{...} +{* 11 Jan 2022}{...} {hline} help for {hi:iegraph} {hline} diff --git a/src/help_files/iekdensity.sthlp b/src/help_files/iekdensity.sthlp index 21235091..df8f797f 100644 --- a/src/help_files/iekdensity.sthlp +++ b/src/help_files/iekdensity.sthlp @@ -1,5 +1,5 @@ {smcl} -{* 5 Nov 2019}{...} +{* 11 Jan 2022}{...} {hline} help for {hi:iekdensity} {hline} diff --git a/src/help_files/iematch.sthlp b/src/help_files/iematch.sthlp index b4813b4f..d81f4f19 100644 --- a/src/help_files/iematch.sthlp +++ b/src/help_files/iematch.sthlp @@ -1,5 +1,5 @@ {smcl} -{* 5 Nov 2019}{...} +{* 11 Jan 2022}{...} {hline} help for {hi:iematch} {hline} diff --git a/src/help_files/ietoolkit.sthlp b/src/help_files/ietoolkit.sthlp index fb6e9dbd..f94f01be 100644 --- a/src/help_files/ietoolkit.sthlp +++ b/src/help_files/ietoolkit.sthlp @@ -1,5 +1,6 @@ {smcl} -{* 5 Nov 2019}{...} +{* 11 Jan 2022}{...} + {hline} help for {hi:ietoolkit} {hline} @@ -21,7 +22,7 @@ command please see the {browse "https://dimewiki.worldbank.org/wiki/Stata_Coding {marker desc} {title:Description} -{pstd}{cmdab:iegraph} This command returns the version of ietoolkit installed. It +{pstd}{cmdab:ietoolkit} This command returns the version of ietoolkit installed. It can be used in the beginning of a Master Do-file that is intended to be used by multiple users to programmatically test if ietoolkit is not installed for the user and therefore need to be installed, or if the version the user has @@ -36,8 +37,8 @@ command please see the {browse "https://dimewiki.worldbank.org/wiki/Stata_Coding {title:Examples} {pstd}The code below is an example code that can be added to the top of any do-file. - the example code first test if the command is installed, and install it if not. If it is - installed, it test if the version is less than version 5.0. If it is, it + The example code first tests if the command is installed, and install it if not. If it is + installed, it tests if the version is less than version 5.0. If it is, it replaces the ietoolkit file with the latest version. In your code you can skip the second part if you are not sure which version is required. But you should always have the first part testing that {inp:r(version)} has a value before using @@ -49,7 +50,7 @@ command please see the {browse "https://dimewiki.worldbank.org/wiki/Stata_Coding {inp} ssc install ietoolkit {inp} } {inp} else if `r(version)' < 5.0 { -{inp} ietoolkit version too old, install the latest version +{inp} *ietoolkit version too old, install the latest version {inp} ssc install ietoolkit , replace {inp} }{text} diff --git a/src/ietoolkit.pkg b/src/ietoolkit.pkg index b25eead4..6904d1b1 100644 --- a/src/ietoolkit.pkg +++ b/src/ietoolkit.pkg @@ -1,4 +1,4 @@ -v 6.3 +v 6.4 d iefieldkit. DIME Analytics iefieldkit public beta d DIME Analytics, World Bank Group, Development Economics Research f /ado_files/iebaltab.ado diff --git a/src/stata.toc b/src/stata.toc index 9d02845b..65dcd4db 100644 --- a/src/stata.toc +++ b/src/stata.toc @@ -1,3 +1,3 @@ -v 6.3 +v 6.4 d DIME Analytics, World Bank Group, Development Economics Research p ietoolkit DIME Analytics