In research, we often have to figure out the number of unique observations- For a small set of data, you can of course just use the command cookbook. However, when you want to create a variable containing the unique number of observation by certain group then you can’t just use Continue Reading
STATA
[STATA] Creating 6 Digit CUSIP and 5 Zip Code
Today, I will cover a super easy code but extremely useful- This is a question that I was asked several times by PhD students and master students who were beginning to code or did not how to code. So how do we extract 6 digit CUSIP from a 9 digit Continue Reading
[STATA] Importing Data
I often get asked what is the best way to import other types of data by my peers and friends- The answer? Use Stat/Transfer– It is the best. I know it is not cheap but it will save you lot of time. And time matters, especially if you need to Continue Reading
[STATA] Converting Dates
As a researcher, I get data with various data formatting- And it was always annoying to convert the dates because I would often forget the codes- So here I share the codes to convert various string dates to STATA format dates. Convert DD/MM/YYYY: gen numeric_date=date(string_date, “DMY”) Convert YYYY-MM-DD or YYYYMMDD: Continue Reading