Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Saving a bysort list in ascii or matrix format


From   William Berrington <[email protected]>
To   [email protected]
Subject   st: Saving a bysort list in ascii or matrix format
Date   Wed, 22 Sep 2010 10:50:03 -0700

I am having trouble saving a file in the correct ascii or sheet format, maybe someone knows a trick. I will use a example from a sysuse file.
I am starting with the following 2 line .do file


sysuse lifeexp
bysort region: list gnppc if (gnppc!=.)

----------
and would like to export the bysort list in the following table either ± the headers:

  +-------------------------+
  | Eur___~a    N_A_   S_A_ |
  |-------------------------|
1. |      810   19170   8030 |
2. |      460    1770   1010 |
3. |    26830    1850   4630 |
4. |      480    1640   4990 |
5. |     2180     410   2470 |
  |-------------------------|
6. |    25380     740   1520 |
7. |     1220    1740   1760 |
8. |     4620    3840   2440 |
9. |     5150    1896   6070 |
10. |    33040    2990   3530 |
  |-------------------------|
11. |     3360    4520      . |
12. |    24280   29240      . |
13. |    24210       .      . |
14. |      970       .      . |
15. |    26570       .      . |
  |-------------------------|
16. |    11740       .      . |
17. |     4510       .      . |
18. |    18710       .      . |
19. |    20090       .      . |
20. |     1340       .      . |
  |-------------------------|
21. |      380       .      . |
22. |     2420       .      . |
23. |     2540       .      . |
24. |     1290       .      . |
25. |      380       .      . |
  |-------------------------|
26. |    24780       .      . |
27. |    34310       .      . |
28. |     3910       .      . |
29. |    10670       .      . |
30. |     1360       .      . |
  |-------------------------|
31. |     2260       .      . |
32. |     3700       .      . |
33. |     9780       .      . |
34. |    14100       .      . |
35. |    25580       .      . |
  |-------------------------|
36. |    39980       .      . |
37. |      370       .      . |
38. |     3160       .      . |
39. |      980       .      . |
40. |    21410       .      . |
  |-------------------------|
41. |      950       .      . |
  +-------------------------+

Is there a way to do this using 1) outsheet, outfile, or file command? =
Or maybe a matrix?

Best,
Bill=


*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index