|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Using tab command on strings, exceeding 65,536 limit
Use Mata. Example (-moremata- required, see -ssc d moremata-):
. mata:
------------------------------------------------- mata (type end to
exit) ----------------------
: void mytabulate(string scalar var)
> {
> st_view(X=., ., var)
> F = mm_freq(X, 1, L=.)
> display("")
> mm_matlist( (F, F/colsum(F)*100), ("%g", "%9.2f"),
> 2, strofreal(L), ("Freq.", "Percent"))
> }
: end
------------------------------------------------------------------------------------------------
. sysuse auto
(1978 Automobile Data)
. mata: mytabulate("mpg")
| Freq. Percent
-----+-------------------
12 | 2 2.70
14 | 6 8.11
15 | 2 2.70
16 | 4 5.41
17 | 4 5.41
18 | 9 12.16
19 | 8 10.81
20 | 3 4.05
21 | 5 6.76
22 | 5 6.76
23 | 3 4.05
24 | 4 5.41
25 | 5 6.76
26 | 3 4.05
28 | 3 4.05
29 | 1 1.35
30 | 2 2.70
31 | 1 1.35
34 | 1 1.35
35 | 2 2.70
41 | 1 1.35
ben
On Jan 16, 2008 8:56 PM, Jeff Simonson <[email protected]> wrote:
> Hello,
>
> I am using Stata 9 and want to get a simple tabulation by city. My file
> consists of over 207,000 rows. When I type in "tab city" I get returned an
> error R134 that warns me that I cannot encode more than 65,536 unique
> values. When I do a select distinct sql statement in my Access table on
> the same field there are only 3046 unique values.
>
> Any suggested work-arounds would be helpful.
>
> Thanks,
> Jeff
>
>
> ____________________________________________________________________________________
> Never miss a thing. Make Yahoo your home page.
> http://www.yahoo.com/r/hs
> *
> * 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/
>
*
* 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/