My data has a date variable, and I want to extract year, month, date information from it:
date
03jun1960 00:00:00
06jun1960 00:00:00
07jun1960 00:00:00
08jun1960 00:00:00
09jun1960 00:00:00
10jun1960 00:00:00
13jun1960 00:00:00
So I use:
gen year = year(date)
But generate missing values only.
How to solve this?
Related Posts with Stata extract year from date
Testing coefficients or predictions with > 500,000 unit fixed effectsPROBLEM: I am examining how mobility fell during a COVID lockdown in two types of communities, slum…
Use margins to obtain indirect marginal effects on a SUR modelHi, suppose I want to estimate the following system of equations, and that I want to capture how doe…
expand data.Dear All, I have this data set Code: * Example generated by -dataex-. To install: ssc install datae…
Concentration Index with Grouped IncomeHi all, I am trying to implement the overall correction for unequal income group stated in Clarke, …
Dataset merging to maximize number of observationsHi, I would like to merge two datasets. Both datasets have the following columns: Year Gvkey Cusip …
Subscribe to:
Post Comments (Atom)
0 Response to Stata extract year from date
Post a Comment