Sendemails

This article introduces a new Stata package, sendemails, which allows instructors, researchers, or students to send emails through Stata, to the benefit of their pedagogical or scientific tasks. This is a simple general and flexible tool, which can be used by anyone and is based on PowerShell, which is open-source and cross-platform since 2016. It allows useful applications such as sending several personalized emails to students or colleagues (e.g., to communicate grades, to spread info to a newsletter, to communicate the end of a long Stata task). The user can insert object, Cc, Bcc, several attachments, and personalize the font through html code. Because of these features, sendemails could be used to conduct online experiments as well, such as correspondence audit tests, without needing coding proficiency. Our manuscript discusses this new package and provides several examples, including a simple correspondence audit test.


Ado file

STHLP file

Examples package

This paper discusses sendemails in greater detail

Milito22

You often run do files/computations that might take a while to be done, but they are not so long (e.g. you are not done with your day and have not left the office). Maybe you keep working at the desk but on something else, or you start doing house tasks (ah, pandemic lockdowns!). If that is the case, you do not need to keep looking at the Stata output to check when it is done doing computations. This simple (and fun) package solves this "very important" issue.


Ado file


What does it do? When the computations are done and Stata reaches the line with the command milito22 (no options needed), Stata will open a software of your choice (e.g. wmplayer) and play a file of your choice (e.g. an mp3 file). You simply have to adjust two parts of one line in this ado file:

!"C:\Program Files\Windows Media Player\wmplayer" "C:\Users\luca_\Documents\Stata 14\ado\personal\gol_di_milito.mp3" 

Adjust the path of the software and the name of the software; adjust the path to the file that the software will open. You can change also the number of times this file will be played in a loop and the time from one repeat to the next one (the ado file contains brief comments on that).

Note: 22 does not stand for the version of the ado, it stands for the jersey number of Diego Milito in FC International Milan.

[PS1: If, like me, you are a supporter of FC International Milan, you can download here the mp3 with the Italian commentary of Diego Milito's goal against Bayern Munich (Champions League final, 2010)]

[PPS: if, differently from me, you are not an FC Inter supporter, you can change the name of the package too] 

Onlyuseful


Imagine you would like to do either of the following things.

You got a paper accepted and want to share the (very large) .dta and the .do file in a public repository; however, the .do file uses only a few of the variables contained in the dataset. 

You want to send via email this dataset, for whatever reason.

To make the .dta file lighter, you can drop from it all of those variables that you do not use in the .do file.

To do that, you need a list of those variables you used, but the do file is BIG!! How boring and time consuming to go through it!

Onlyuseful does all you need automagically (this package is the result of a great interest on a twitt of mine, X--former Twitter)


First, you copy-paste the .do file that you want to "scan" into a .txt file (i.e., referred to as "newtxt" in the help file).  Typically, this file is where you conducted analyses on the .dta file (item in the option "dta"). Then, run the command onlyuseful in a new Stata session with the options.  Onlyuseful automagically conducts four operations in sequence: (1) it creates a local with the list of variables from "dta" by means of the command ds. (2) it looks for variables that are both in the above list and in the .txt file copy of the .do file you wanted to scan. (3) in batch mode, it opens the .dta file and keeps the variables in the list created in (2). (4) Stata in batch mode creates a log file that shows the list of variables you kept and tells you the quantity of variables you dropped; the latter information comes from the local saved by the command keep (i.e., r(k_drop)). [for some reason, this last information is not displayed in Stata versions older than 17; I am not sure how old though: in the office I have Stata 17, while at home I have Stata 14 and only at home it does not work; I do not know what is the response for Stata 15 and 16]


Ado file

STHLP file