Add current date to Stata file names (and others)

We wrote earlier about how to add time stamps (current date and/or time) to your Stata figures, e.g. to keep track of work in progress results. A similar strategy can be used when storing log-files, which are typically overwritten with a more recent version of the same log.

Continue reading “Add current date to Stata file names (and others)”

Weekly data: calendar week vs. Stata weeks

In my dataset, I have information on a number of workers for each week. The raw data I receive (no Stata format) contains information on the year and the week (1, 2, …, 52). Here, a week is defined as the first week of a year which has at least 4 days in January. E.g., the week 1/2009 starts already on December 29, 2008. A result of that is that for some years, a year has 53 calendar weeks. Continue reading “Weekly data: calendar week vs. Stata weeks”

Managing time variables in Stata and SPSS

I just came across the problem that a date in Stata is not the same as a date in SPSS. They are, however, based on the same principle: time variables, e.g. a variable containing days, contain the number of elapsed time units (days, weeks, months, seconds, or other date units) since a base date which is defined by the software.

In Stata, the base date is the first time unit in 1960 (e.g. January 1, 1960). For other time units, Continue reading “Managing time variables in Stata and SPSS”