Dear all:
I'm looking for some assistance in using the "reshape" command. I've attached a small sample of the actual data. This is a text file, created by excel.
There are 5 variables: identification, exam_name, exam_date, exam_outcome, and exam_score.
Some obervations have the same idnumber, since an individual may have taken more than one examination or may have taken the examination mutiple times (e.g., failing the first time and passing the second or third time). I want to merge this file with another and use the examination score in a regression.
Is there some way to use the "reshape" command (or another procedure) to create one observation per
identification? For example, if the individual has taken 5 specialty examinations I'd like to create an observation that looks the
following:
idnumber exam_name1 exam_date1 exam_outcome1 exam_score1 exam_name2 exam_date2 exam_outcome2 exam_score2 ...
Here's what I've tried (and the error message).
generate edate = date(exam_date, "mdy") /* change string variable to numeric variable */
drop exam_date
reshape wide exam_score, i(identification) j(edate)
(note: j = 14715 14827 14911 14995 15086 15184 15359 15450 15548 15639 15730 15912)
edate not unique within identification; there are multiple observations at the same edate within identification.
Type "reshape error" for a listing of the problem observations.
r(9);
Thanks for your assistance.
-plm
Attachment:
sample data.txt
Description: Binary data