Hello,
I have a variable "EndDate" whose format is double yet displays as if it was %tc. I need to identify the maximum date by categories of the group "id" using this variable. After formatting the variable to %tc, the "bys id: egen max" function calculates a different %tc date compared to any of the original dates within any single id. I haven't been able to solve the problem. Thank you.
format EndDate %tc
bys id: egen maxenddate=max(EndDate)
format maxenddate %tc
id EndDate maxenddate
1 01feb2023 10:51:32 01feb2023 18:00:33
1 01feb2023 18:00:14 01feb2023 18:00:33
1 31jan2023 06:45:08 01feb2023 18:00:33
Related Posts with Trouble working with %tc dates
Nearest Neighbour matching with exact matches and without replacementDear all, without actually being interested in the estimation of a treatment effect, I want to find…
interpretation of interactions in mixed modelHi all, I am running the following mixed model (code and results shown below). Notes: Y is continuo…
Hausman TaylorHi Statalist, I am relatively new to stata, albeit I would like to conduct an analysis using the Ha…
Matching DataHi Everyone, I’m very new to STATA and would really appreciate some help – please be as detailed as…
log file not foundHi . log using chp2 file C:\WINDOWS\system32\chp2.smcl could not be opened r(603); What could be ca…
Subscribe to:
Post Comments (Atom)
0 Response to Trouble working with %tc dates
Post a Comment