Hello friends,
I am currently using data that has one variable that shows the value of the date, for example, a variable named effective_date shows the value 20120105 means 2012-January-5th. If I only need the value of year (for my analysis purpose, as I need to create an arrival cohort based on years, not the exact date).
Right now I recode it like (20120000/20129999 = 2012), It works, but I am curious is there a way to formate variable just show the first four digitals instead of recoding it?
Please advise
Thanks
Related Posts with Is there a way to format variable?
Shrinkage of estimates towards group mean using Mixed Effects Models for a binary outcomeHello Statalist, I have survey data that collected individual level use of a bed net against mosqu…
[Panel] Preceding observations with values lower than that of the current observationHi, I am using panel data with the following structure: a single task (Task_id, also the panel id) …
Drop variables in STATA if next year data is missingHello, I need some help I have large unbalance panel data and I need to drop the Person ID (PID) if…
Finding Beta's from different periods in timeHi, I am trying to find beta's for different stocks at in different time periods (when they were no…
Instrumented diff-in-diff with ivreg2Dear Statalist, I am struggling with an endogenous treatment in a diff-in-diff model I am using (at…
Subscribe to:
Post Comments (Atom)
0 Response to Is there a way to format variable?
Post a Comment