# st: Re: Creating a variable with a Panel Data Set

 From "Daniel Egan" <[email protected]> To <[email protected]> Subject st: Re: Creating a variable with a Panel Data Set Date Sat, 21 Aug 2004 21:00:25 -0400

```Hi Ann,

Ann asked <snip>  I am able to create a variable for number of days in a
team, but it counts by the number of calendar days rather than working days.
I was wondering if anyone knew which commands and exactly how to create the
variable so that is counts the number of working days that a worker was on a
team. <snip>

*First, make sure that your date variable is in date format. If it is not,
you will need to generate it to be (search date functions).

des date
*should return     %d.....
*Then, created a day-of-week variable corresponding to each date:

gen dowd=dow(date)

*use a dummy to indicate work days

gen weekD=1
replace weekD=0 if dowd==5 | dowd==0

then use the dummy to filter out weekend days. This can be done a number of
ways, depending on the structure of your cross section.

Good luck,

Dan

----- Original Message -----
From: Ann Hapanowicz
To: [email protected]
Sent: Saturday, August 21, 2004 2:47 PM
Subject: st: Creating a variable with a Panel Data Set

Hi:
I am a Hamilton College student working on an independent project and I have
a question about creating a variable for a data set that I am using to look
at the relationship between worker productivity and a firm's human resource
management practices.  I have a panel data set for a firm that is a  cross
sectional unit by worker with a daily time dimension.  I  would like to
create a variable that calculates the number of days a worker has been on a
team.  The dates run from  Jan99-Nov01 and I have the date and measure of
productivity for each worker on every day that they worked at the firm.  I
also have a variable that tells the date of when a worker joined a team.
There are observations only if a worker worked on that date.  The date
variable is in the form of "02Jan01".
I am able to create a variable for number of days in a team, but it counts
by the number of calendar days rather than working days.  I was wondering if
anyone knew which commands and exactly how to create the variable so that is
counts the number of working days that a worker was on a team.