[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Case conversion in stringvars (and 2 cmds with same name)
I have corporate announcements data where records of a string var are inconsistently capitalised, which makes analysis difficult. To illustrate, the following records should really appear as one and the same:
Annual Report and Accounts
Annual Reports and Accounts
Annual report and accounts
Annual reports and Accounts
Annual reports and accounts
I can globally replace 'reports' by 'report' in a text editor but would like to automate case conversion in Stata if I could - say, convert everything to lower case (or just the first word capitalised, or every word in the header). -renvars- does this but for variable names, not observations. -mixcase-, on the other hand, seems just the job, but it was written by Bill Gould nearly ten years ago (it was part of dm13.1) so I doubt it would run smoothly three or four versions of Stata later. Is anyone aware of an update to this routine or an alternative way of doing the same?
As part of my search for this, I think I came across two ado files that do something quite similar and bear the same name but are clearly distinct in their syntax (ie the later one doesn't look like an update of the earlier one). The first instance of -replstr- was written by Bill G (dm 13.1 again) while the second (dated 1999) is authored by Wim Van Putten (-findit replstr- brings this up).
* For searches and help try: