Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: SPSS count syntax


From   Kit Baum <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: SPSS count syntax
Date   Sat, 28 Oct 2006 15:07:39 -0400

. forv i=1/4 {
  2. egen n`i' = anycount(rep1-rep6),values(`i')
  3. }

. l rep* n*

     +-------------------------------------------------------------+
     | rep1   rep2   rep3   rep4   rep5   rep6   n1   n2   n3   n4 |
     |-------------------------------------------------------------|
  1. |    3      1      1      4      2      1    3    1    1    1 |
  2. |    3      1      1      4      2      1    3    1    1    1 |
  3. |    3      1      1      4      2      1    3    1    1    1 |
  4. |    3      1      1      4      2      1    3    1    1    1 |
  5. |    3      1      1      4      2      1    3    1    1    1 |
     |-------------------------------------------------------------|
  6. |    3      1      1      4      2      1    3    1    1    1 |
  7. |    3      1      1      4      2      1    3    1    1    1 |
  8. |    3      1      1      4      2      1    3    1    1    1 |
  9. |    2      2      2      3      3      4    0    3    2    1 |
10. |    3      1      1      4      2      1    3    1    1    1 |
     |-------------------------------------------------------------|
11. |    3      1      1      4      2      1    3    1    1    1 |
12. |    3      1      1      4      2      1    3    1    1    1 |
13. |    2      2      2      3      3      4    0    3    2    1 |
14. |    2      2      2      3      3      4    0    3    2    1 |
15. |    3      1      1      4      2      1    3    1    1    1 |
     |-------------------------------------------------------------|
16. |    2      2      2      3      3      4    0    3    2    1 |
17. |    2      2      2      3      3      4    0    3    2    1 |
18. |    2      2      2      3      3      4    0    3    2    1 |
19. |    3      1      1      4      2      1    3    1    1    1 |
20. |    3      1      1      4      2      1    3    1    1    1 |
     |-------------------------------------------------------------|
21. |    3      1      1      4      2      1    3    1    1    1 |
22. |    3      1      1      4      2      1    3    1    1    1 |
23. |    3      1      1      4      2      1    3    1    1    1 |
24. |    3      1      1      4      2      1    3    1    1    1 |
25. |    3      1      1      4      2      1    3    1    1    1 |
     |-------------------------------------------------------------|
26. |    3      1      1      4      2      1    3    1    1    1 |
27. |    3      1      1      4      2      1    3    1    1    1 |
28. |    3      1      1      4      2      1    3    1    1    1 |
29. |    1      3      3      2      4      3    1    1    3    1 |
30. |    3      1      1      4      2      1    3    1    1    1 |
     |-------------------------------------------------------------|
31. |    3      1      1      4      2      1    3    1    1    1 |
32. |    3      1      1      4      2      1    3    1    1    1 |
33. |    2      2      2      3      3      4    0    3    2    1 |
34. |    1      3      3      2      4      3    1    1    3    1 |
35. |    3      1      1      4      2      1    3    1    1    1 |
     |-------------------------------------------------------------|
36. |    3      1      1      4      2      1    3    1    1    1 |
37. |    2      2      2      3      3      4    0    3    2    1 |
38. |    3      1      1      4      2      1    3    1    1    1 |
39. |    3      1      1      4      2      1    3    1    1    1 |
40. |    3      1      1      4      2      1    3    1    1    1 |
     +-------------------------------------------------------------+



Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index