orgtheory.net

100% compatible with the previous releases

Gabriel 

When I’m not inadvertently serving my discipline by providing negative case studies in academic etiquette, I analyze pop music radio data. In my current project, my co-authors and I are looking for patterns in the diffusion trajectories in hundreds of pop songs. Since the raw data isn’t in the appropriate form, it takes a bit of code to clean it.

The last time I ran my cleaning scripts was under Stata 9 and when I ran it yesterday under Stata 10, it gave me a dataset where several of the key variables had all missing values. Since the cleaning script is 574 lines of code it took me a couple hours to identify where the problem was and I eventually isolated the offending line of code.
gen fpdate=date(firstplayed,”mdy”)

The issue was something with how Stata handled dates. I then read the manual entry “[D] dates and time” and got such a thorough treatment of leap seconds and microseconds and atomic decay that I could imagine both Augustine of Hippo and Albert Einstein saying “you know, I think they’re belaboring the point.” Finally, I got to the point on converting strings to dates and it looked like I was doing the right thing, but I decided to enter their code anyway.
gen fpdate=date(firstplayed,”MDY”)

Yes, the problem was that the new syntax requires uppercase codes for month, day, and year, whereas the old syntax used lowercase codes. Just now, I noticed the following in the help file:

Historical note: Stata 10’s date() function is much improved over that of previous versions, and the mask is specified a little differently. In previous versions, the codes for year, month, and date were y, m, and d rather than Y, M, and D.

I actually agree that the new function is improved and if I were starting from scratch it would have been easier to code using the v10 command. (I round off events to the nearest week, which is built into v10 but to do it in v9 you have to divide by 7, force the data to integer format, and multiply by 7 again). What I don’t get is why they couldn’t have made the improvements without changing the mdy codes to MDY?

btw, the title to this post is ultimately from the manual but proximately from Jeremy’s post in which he describes a similar experience a few months ago.

Advertisement

Written by gabrielrossman

September 29, 2007 at 3:41 am

2 Responses

Subscribe to comments with RSS.

  1. Stata actually makes a huge effort for backwards compatibility. Just put -version 9- at the top of your program.
    http://www.stata.com/help.cgi?version

    Like

    Andy

    October 12, 2007 at 3:48 am

  2. andy,

    this is true, but if you use version control you can’t use any of the other features of the new version. it’s pretty much good for running old do files as is, but if you want to update old do files to exploit new features then you’re pretty much out of luck.

    Like

    gabrielrossman

    October 12, 2007 at 3:12 pm


Comments are closed.

%d bloggers like this: