Just an observation, Michael, your solution didn't thread into the
topic in my mail program, although it is properly threaded in the
Archive. It happens sometimes (actually, all the time) that replies
to threads don't properly thread and can get missed.
I very much like your solution as it is quite parsimonious of code,
although with a different dataset having a number of datatypes the
destringing process might not be as easy. While I didn't implement it
originally, I think I would simply use the variable label next time
combining some of my code and Michael's to produce:
X--------begin---------X
clear
insheet using c:\ado\test\testfile.raw
foreach V of varlist _all {
local date=date("`:variable label `V''","mdy")
if "`date'" !="." { // variable has label in date format
local year=year(`date')
local monthday:di %dmd `date'
local vname= "rev_"+trim("`monthday'")+"_"+trim("`year'")
rename `V' `vname'
}
}
list
reshape long rev_ , i(acct) string
list
X--------end---------X
I think this combines the best of both approaches.
DC Elliott
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/