7 tools to make your stata life more pleasant
play

7+ tools to make your Stata life more pleasant Jesse Wursten 1 - PowerPoint PPT Presentation

7+ tools to make your Stata life more pleasant Jesse Wursten 1 London SUGM, August 2019 1 Faculty of Economics and Business KU Leuven 1 User-Computer Interaction Four commands that make the computer talk to you sendtoslack cdo


  1. 7+ tools to make your Stata life more pleasant Jesse Wursten 1 London SUGM, August 2019 1 Faculty of Economics and Business KU Leuven 1

  2. User-Computer Interaction Four commands that make the computer talk to you • sendtoslack • cdo • stop • beep 2

  3. sendtoslack Send a message from Stata to your smartphone • Stata tells Powershell what to send and who to send it to • Powershell sends that info to Slack • Slack sends you your message • You receive the message on your desktop or smartphone Some notes • Easily integrated in other programs (as you will see) • Options can be saved in profjle.do • Available on SSC 3

  4. sendtoslack 4

  5. cdo -do- things with some extra options • Send message to phone on success • Execute local copy • Run program on dofjle end • Make log of this run Some notes • Example of sendtoslack being integrated • cdo can add timestamps to the logfjle names • Available on SSC 5 • Send message to phone on failure

  6. cdo 6

  7. cdo 7

  8. cdo 8

  9. cdo 9

  10. stop stops a dofjle • Can send a message to smartphone • Closes log fjles (if you want to) • That’s more or less it Some notes • It feels wrong to write errors into my code • Available on SSC 10

  11. stop 11

  12. beep Produces a beep • Start your dofjle • Then add the beep command in the command window Some notes • Requires sound • The beep is moderately annoying • Built-in 12

  13. beep 13

  14. Lazy Programming Five commands that help the lazy programmer • batcher • timeit • smallfjleversioning • censusapi • makecode 14

  15. batcher Task parallelisation in Stata • Give batcher a set of arguments (numlist) • Batcher opens a new Stata instance • ... runs dofjle with fjrst argument • ... opens new Stata, run dofjle with second argument, etc • ... reports back when instances fjnish/crash Some notes • Integrated with sendtoslack • Requires minor adaptation to dofjle • Available on SSC 15

  16. batcher 16

  17. batcher 17

  18. timeit Single-line timer • Prefjx timeit #: • Use timer list to obtain results Some notes • You can also give the timers names • Also saves incremental timers • Available on SSC 18

  19. timeit 19

  20. smallfjleversioning (sfv) Saves old versions of dofjles automatically • You tell sfv which folders to watch and how often • sfv checks if any of the fjles in there have changed • ... if so, it copies those fjles to a different folder • ... and names them according to the change date/time Some notes • Very easy to set up • Less effort than github or manual duplication • Not limited to dofjles 20 • Available on Github: http://bit.ly/sfv_sugm

  21. sfv 21

  22. sfv 22

  23. censusapi Accessing the US Census API • Hides most of the ‘API’-part behind the scenes • Splits the URL into options to make code more readable • Allows for P0100001-P0100022 varlist style • Splits Census calls of too many variables Some notes • Only tested on Decennial Census and QWI • Available on SSC 23

  24. censusapi 24

  25. censusapi 25

  26. makecode Create structured code blocks • Can only explain this in picture Some notes • Meant to be customised • Considering move to Powershell • Not publicly available (email me) 26

  27. makecode 27

  28. makecode 28

  29. makecode 29

  30. Bonus tricks Old tools sometimes work best • Windows copy path • Label data/variable/values 30

  31. Any Questions or Suggestions? I highly recommend the Metropolis Theme for Beamer (modifjed version used in this presentation), it can be found at https://github.com/matze/mtheme 31

Recommend


More recommend