s-news
[Top] [All Lists]

Coding Question

To: <s-news@lists.biostat.wustl.edu>
Subject: Coding Question
From: "Roberts, J. Kyle" <jkrobert@bcm.tmc.edu>
Date: Tue, 24 Jan 2006 15:24:16 -0600
Thread-index: AcYhLIevb2LisvntT4CAbdM1wo4QMg==
Thread-topic: Coding Question
I have a dataset in which I need to dummy code (sort of) two separate variables.
 
Variable 1
I have 5 years of data on students in teachers classrooms.  Each teacher entered the intervention at different times (years 1-6).  I need to code a date variable for each student as zero for each student in the classroom before the intervention, and as a "1" when the intervention started.
For example, in this case, the variable "new.var" would be created from "year" and "int.year".
teach  stud   year  int.year  new.var
1        1      1        3        0
1        2      1        3        0
1        3      2        3        0
1        4      2        3        0
1        5      3        3        1
1        6      3        3        1
1        7      4        3        1
1        8      4        3        1
 
Variable 2
This is like the above data, but I need the new.var.2 variable to begin counting up from the intervention year.  For example:
teach  stud   year  int.year  new.var.2
1        1      1        3        0
1        2      1        3        0
1        3      2        3        0
1        4      2        3        0
1        5      3        3        1
1        6      3        3        1
1        7      4        3        2
1        8      4        3        2
 
Thanks,
Kyle
 
***************************************
J. Kyle Roberts, Ph.D.
Baylor College of Medicine
Center for Educational Outreach
One Baylor Plaza, MS:  BCM411
Houston, TX   77030-3411
713-798-6672 - 713-798-8201 Fax
jkrobert@bcm.edu
***************************************
 
<Prev in Thread] Current Thread [Next in Thread>