The original problem has already been solved,
but I want to comment on one detail.
Bob recommends that you install -catenate-.
I recommend that you don't do that.
The explanation is provided by the package description:
"-catenate- generates a new string variable by concatenating
varlist. The variables in varlist may be string or numeric. Note
added 2004: this package was written for Stata 5 and is now
superseded by -egen, concat()- in up-to-date Statas."
As -egen, concat()- is part of official Stata you need
do nothing, assuming that you have Stata 7 or up.
You might well ask: why does -catenate- still sit
on SSC if it has been superseded? In essence, SSC
functions as an archive, and -catenate- remains accessible
to those using old Statas, or (more importantly in
this case) to those who may be using old Stata do
files or programs that may use -catenate-. If such
a do file or program should fail, a query could be
resolved by pointing to -catenate-. Hence, the
existence of -catenate- might do some good, and
should do no harm.
Nick
[email protected]
Robert A Yaffee
> Dear Joe,
> You can use the substr function to extract the date and
> time into separate string variables.
> Use ssc install catenate
> then you can construct a new datetime variable such as mydt
> = catenate datestr + timestr)
> Then use transform this into a Stata date time function
> with gen double statadt = clock(mydt, "YMD hms")
> Then format this with the new format statdt %tc
*
* 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/