From the course: Advanced and Specialized Statistics with Stata
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Date and time variables - Stata Tutorial
From the course: Advanced and Specialized Statistics with Stata
Date and time variables
- [Instructor] In this session, we're going to explore how to deal with date information in Stata. Date information often comes in string format that needs to be converted to a numeric format. Date formats can also take many different shapes. For example, in some countries, the month is written before the day, followed by the year. Or in other parts of the world, the sequence might be day, month, year. Alternatively, sometimes date information is already in the numerical format. But it could be spread across multiple variables. For example, one variable for year, one for month, and one for day. Well, they need to piece all this together. Finally, you should be aware that the Stata date is simply a number which counts the number of days since the first of January 1960. In other words, Stata will interpret the number one to be the second of January 1960. Here's an example of a small data sets with date information. The…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
(Locked)
Formatting the display of variables5m 56s
-
(Locked)
Date and time variables6m 41s
-
(Locked)
Repeating commands by looping over variables5m 2s
-
(Locked)
Repeating commands by looping over numbers5m 34s
-
(Locked)
Repeating commands by looping within loops4m 43s
-
(Locked)
Accessing results saved from Stata commands7m 12s
-
(Locked)
Challenge: More on data management52s
-
(Locked)
Solution: More on data management5m 15s
-
(Locked)
-
-
-
-
-
-
-