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: RE: Saving a bysort list in ascii or matrix format


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: RE: Saving a bysort list in ascii or matrix format
Date   Wed, 22 Sep 2010 20:04:51 +0200

<>

I have no idea what this could be good for, but here you go:


***********
sysuse lifeexp, clear
keep if (gnppc!=.)
separate gnppc, by(region) generate(reg)
keep reg?
l
outsheet using "C:\Users\martin\Documents\Stata\myfile.txt", replace
!start myfile.txt
***********


HTH
Martin


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of William
Berrington
Sent: Mittwoch, 22. September 2010 19:50
To: [email protected]
Subject: st: Saving a bysort list in ascii or matrix format

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/


*
*   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