Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: AW: RE: alternative calculation method due to "too many values" / tabulate


From   "Martin" <gruleff@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: RE: alternative calculation method due to "too many values" / tabulate
Date   Mon, 5 Mar 2012 13:14:31 +0100

Thank you very much for help.

I have used the reshape command and it worked very good. The solution was to
use the following command, perhaps it`s also works for others:

reshape wide count, i(FSHNETCSP3) j(luse_csp)

Martin

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Nick Cox
Gesendet: Freitag, 2. März 2012 15:47
An: 'statalist@hsphsun2.harvard.edu'
Betreff: st: RE: alternative calculation method due to "too many values" /
tabulate

If you could compute a table with 220,000 rows what you do with it? This
does seem like a case in which a reduced dataset will be the most convenient
solution. 

By the way, although -collapse- has already been mentioned for this, in some
ways -contract- is more direct. 

Alternatively, consider 

bysort FSHNETCP3 luse_csp : gen sumcount = sum(count) 
by FSHNETCP3 luse_csp : replace sumcount = sumcount[_N] 
by FSHNETCP3 luse_csp : gen tag = _n == 1 
list FSHNETCP3 luse_csp sumcount if tag 

Alternatively, consider -groups- from SSC. 

Nick 
n.j.cox@durham.ac.uk 

Martin

I would like to calculate the values which I have in my table in this form:

FSHNETCSP3      luse_csp              count
0               10                      500
0             1010                      124
1               10                      500
2             1010                      240
2               10                      120         
3             1010                      130
3               10                      120
4               10                      101
......

To receive the following result:

           |                                       luse_csp
FSHNETCSP3 |         0          1          2          3          4
5         10       1000 |     Total
-----------+----------------------------------------------------------------
------------------------+----------
         0 |         0          9          0          0          5
0        327          3 |       344 
         1 |         0          0          0          0          0
0        315          0 |       315 
         2 |         0          5          0          0          0
0        321          5 |       331 
         3 |         0          0          0          0          0
0        439          1 |       440 
         4 |         0          0          0          0          0
0        412          8 |       420 
         5 |         1          2          3          0          0
0        440          0 |       446 
         6 |         0          0          0          0          0
0        413          7 |       420
........

I used the following command:
. tabulate FSHNETCSP3  luse_csp [fweight =  count] in 1/1000

However, because I have 220.000 different FSHNETCSP3 values I get the error
"too many values". I tried the "bigtab" command from the list, but there I
can`t add a weight. I don`t want to use collapse because I need the exact
values for further calculations.


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