Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: how create a year variable

From   Kyle Hood <[email protected]>
To   [email protected]
Subject   Re: st: how create a year variable
Date   Tue, 14 Nov 2006 18:02:40 -0500 (EST)

how about

. gen year = real( substr( date , 7 , 1 ) )

Look at

. help strfun

for specifics.  "date" is the name of the date variable.

On Tue, 14 Nov 2006, Giulio Michele Bosio (giulio.bosio) wrote:

Dear all,

I'm working on a panel of administrative data of employment episodes. I have a variable in mdy format (%dD/N/CY) that gives me the beginning of each job spells. I need to use panel routine in Stata and so I would like to know if it's possible to extract from this variable the year to generate a year variable for each observation and how to do this. What commands I have to digit?

Than you very much in advance.

Giulio Bosio

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index