Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: using reshape command


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: RE: using reshape command
Date   Thu, 9 Oct 2008 16:49:25 +0200

FAQ, 2.2: " We ask you not to post formatted messages or attachments"


HTH
Martin


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Patrick Mason
Sent: Thursday, October 09, 2008 4:44 PM
To: [email protected]
Subject: st: using reshape command

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





*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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