<>
For the case of missings in the first observation, you may even want to use
-firstnm- when -collapse-ing:
*************
clear*
inp byte(School Student Classize female)
1 1 . 1
1 2 35 0
1 3 35 1
1 4 35 1
2 1 23 0
2 2 23 1
2 3 23 1
3 1 39 0
3 2 39 1
end
collapse (firstnm) Classize, by(School)
li, noo sepby(School)
*************
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Martin Weiss
Gesendet: Mittwoch, 16. Dezember 2009 16:45
An: [email protected]
Betreff: st: AW: RE: AW: Creating single values from a nested data file
<>
Looks like a case for -collapse- to me:
*************
clear*
inp byte(School Student Classize female )
1 1 35 1
1 2 35 0
1 3 35 1
1 4 35 1
2 1 23 0
2 2 23 1
2 3 23 1
3 1 39 0
3 2 39 1
end
collapse (first) Classize, by(School)
list, noo sepby(School)
*************
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Russel Wildeman
Gesendet: Mittwoch, 16. Dezember 2009 16:43
An: [email protected]
Betreff: st: RE: AW: Creating single values from a nested data file
Thank you Martin
The data look like this
School Student Classize female
1 1 35 1
1 2 35 0
1 3 35 1
1 4 35 1
2 1 23 0
2 2 23 1
2 3 23 1
3 1 39 0
3 2 39 1
What I would like is for one of the school-level variables (classize) to
have only one observation per school. Hope I am a bit clearer.
Many thanks,
Russell
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Martin Weiss
Sent: 16 December 2009 04:03 PM
To: [email protected]
Subject: st: AW: Creating single values from a nested data file
<>
Could be a case for -reshape- or -collapse-. For further help, you should
post a meaningful excerpt of your data.
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Marcello Pagano
Gesendet: Mittwoch, 16. Dezember 2009 15:04
An: [email protected]
Betreff: st: Creating single values from a nested data file
For Russell:
*From:* Russel Wildeman [mailto:[email protected]]
*Sent:* 15 December 2009 07:36 PM
*To:* '[email protected]'
*Subject:* Creating single values from a nested data file
Dear Listers,
I am new to Stata and have the following question.
I have education survey data where the data are ordered by school and
student and more pertinently the variable ?school.? The data are ordered
by the variable ?school? and would give 0 0 0 0 1 1 1 1 etc. I have
created appropriate school-level variables but the problem is that the
values of the school-level variables are repeated for the same school,
whereas I want only one record per school for some of the school-level
variables. I tried various merging file schemes but none work. Any help
is highly appreciated
Thanks
Russell
*
* 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/
*
* 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/
*
* 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/