Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | keeler james <keelercalchas@hotmail.com> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | RE: st: RE: Presenting data in a desired form |
Date | Thu, 24 Jun 2010 22:07:41 +0100 |
Many thanks for the message, Martin. I shall try it out. Calchas ---------------------------------------- > From: martin.weiss1@gmx.de > To: statalist@hsphsun2.harvard.edu > Subject: st: RE: Presenting data in a desired form > Date: Thu, 24 Jun 2010 00:35:00 +0200 > > > <> > > " Q1. How can I separate each candidate in an individual txt file with all > their subjects in it?" > > > > *********** > clear* > > inp str3 Name int CandidateNo str10 Subject Grade:mylabel int Mark, auto > xxx 1234 English A 80 > xxx 1234 Maths B 65 > xxx 1234 Chemistry C 55 > yyy 0165 English D 40 > yyy 0165 Maths E 30 > zzz 3656 English C 50 > zzz 3656 Maths B 67 > end > > list, noo > > quietly levelsof CandidateNo > > foreach lev in `r(levels)'{ > outsheet using myfile`lev'.txt if CandidateNo==`lev', replace > } > *********** > > > See NJC`s FAQ at http://www.stata.com/support/faqs/data/foreach.html > > HTH > Martin > > > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of keeler james > Sent: Donnerstag, 24. Juni 2010 00:25 > To: statalist@hsphsun2.harvard.edu > Subject: st: Presenting data in a desired form > > Dear Statalist, > > Good evening! > > If I have a data set in the Stata editor as follows: > > Name CandidateNo Subject Grade Mark > 1. xxx 1234 English A 80 > 2. xxx 1234 Maths B 65 > 3. xxx 1234 Chemistry C 55 > 4. yyy 0165 English D 40 > 5. yyy 0165 Maths E 30 > 6. zzz 3656 English C 50 > 7. zzz 3656 Maths B 67 > > > Q1. How can I separate each candidate in an individual txt file with all > their subjects in it? > > Q2. How can I arrange the data in the following form? > > _________________________________ > > Name CandidateNo > xxx 1234 > > Subject Grade Mark > English A 80 > Maths B 65 > Chemistry C 55 > _________________________________ > > Any help will be highly appreciated - also any book/webpage I can read > relating to this? > > Calchas > > > > _________________________________________________________________ > http://clk.atdmt.com/UKM/go/197222280/direct/01/ > We want to hear all your funny, exciting and crazy Hotmail stories. Tell us > now > * > * 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/ > > > * > * 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/ _________________________________________________________________ http://clk.atdmt.com/UKM/go/197222280/direct/01/ Do you have a story that started on Hotmail? Tell us now * * 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/