Dear Colleagues
Please help: I am trying to extract the first 8 characters (NEWdate) from a date format (OLDdate) which has timestamp in it.
OLDdate's format is %tc
OLDdate NEWdate
14jan2011 00:00:00 14jan2011
I have tried the two commands below and they dont seem to work:
gen NEWdate = substr(OLDdate, 1, 9))
format NEWdate %td
gen NEWdate = dt(OLDdate_Date, 1, 9)
format NEWdate %td
Thanks for your help.
Regards
Fadzai
Related Posts with Extracting subset date from a timestamp date variable
Estamating standard errors in Finance Panel Data SetsDear Stata users, I'm dealing with an unbalanced panel dataset of many individuals over two years, m…
Generating current quarter forecasts using only past data when the number of variables is very largeHi I have several variables at each week of the quarter (12 weeks per quarter in a stylized calenda…
Egen mean using only one value per subgroup?Hi! I want to use the egen command to create group means, using the by() command. Basically, "egen …
Warning:Variance matrix is non-symmetric or highly singular *NO DUMMY VARIABLES*Dear Statlisters, I am estimating a demand system with 4 goods, usingthe aidsills command, using Sta…
Dropping groups of observations conditioned on an "if" statement.Hello, I am trying to get rid of observations from gvkey where fyear does not include either 2014 o…
Subscribe to:
Post Comments (Atom)
0 Response to Extracting subset date from a timestamp date variable
Post a Comment