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
Rounding values (less decimale points) in map legend using spmapDear all, I am creating maps using the user written programme spmap (see ssc install spmap). My cod…
Keep observations with matching keyword in string variable textI would like to restrict my analysis to variables with a particular keyword in text. The dates are …
Note alignment in twoway graphsDear statalisters, I would like to align some notes below a twoway graph. So far I have only been a…
test for paired sample with unequal variancesDear Statalists, I have two sample (348 cases and 371 controls) matched by sex and age. Now I would…
Explaining analysis with 'cluster' and 'robust' commandDear reader, I have a short and simple question. After doing an xtreg analysis, using a random effe…
Subscribe to:
Post Comments (Atom)
0 Response to Trouble working with %tc dates
Post a Comment