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]

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


From   Steve Nakoneshny <scnakone@ucalgary.ca>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: alternative calculation method due to "too many values" / tabulate
Date   Fri, 2 Mar 2012 07:27:17 -0700

Martin,

I approach problems such as this with a judicious use of -preserve- and -restore-. By using -preserve- before you use -collapse-, you retain the flexibility to "undo" any changes / transformations you make via -restore-.

Steve

Sent via carrier pigeon

On Mar 2, 2012, at 7:06 AM, "Martin" <gruleff@gmx.de> wrote:

> Dear stata cumunity,
> 
> 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.
> 
> Can someone help? This is my first post so just say if the form of this mail
> isn´t good. I am a beginner.
> 
> 
> Thank you very much and best regards,
> Martin
> 
> 
> 
> *
> *   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