Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: data manipulation


From   David Airey <[email protected]>
To   [email protected]
Subject   st: data manipulation
Date   Tue, 12 Oct 2004 12:31:45 -0500

Dear all,

I have the following toy data set:

. list case clones nA notA in 1/5 , sum

+----------------------------+
| case clones nA notA |
|----------------------------|
1. | 1 33 27 6 |
2. | 2 34 26 8 |
3. | 3 35 23 12 |
4. | 4 33 22 11 |
5. | 5 33 27 6 |
|----------------------------|
Sum | 15 168 125 43 |
+----------------------------+

I would like to expand the data set to 168 observations in which each case is expanded to nA 1's and 6 0's while retaining the case identification. I'm thinking I need to make the data like:

case n response
1 27 1
1 6 0
2 26 1
2 8 0

and then expand response by n respecting case.

Any clues?

-Dave

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* 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