Statalist


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

Re: st: new problem with table display


From   n j cox <[email protected]>
To   [email protected]
Subject   Re: st: new problem with table display
Date   Wed, 31 Oct 2007 11:01:33 +0000

Whether it's done by an ado file is not the issue.
Several tabulation programs in official Stata are
defined by ado files, but you could go a long time
without ever knowing that or suffering from the fact.

I guess Richard's import is that you should not need
to resort to user-written add-ons to solve this problem.

I agree with that.

Part of the explanation, I suspect,
and it's not an excuse, is that the -tabulate- command
is really old, and some of its details still reflect what
was standard about 20 years ago. I guess most people
would agree that Stata's tabulation commands are a
rather complicated mess and ripe for overhaul. I guess
most people would disagree about quite how to do that.

As many people have pointed out, the situation is somewhat
similar to that of graphics before Stata 8.

Let me write down a guess at everyone's wish-list.

1. I want tabulation commands that do the simple tables
I want to do frequently very easily. (Now get the union
of such wishes across the Stata community.)

2. I want tabulation power to do the very complicated tables
I want occasionally as easily as possible. (Same comment.)

3. I want to do all of that without any programming,
or even complicated syntax.

4. I want the whole thing to be documented very concisely.

5. Nothing that is added to Stata should in any sense break
do files or programs or habits already in use.

These are all understandable wishes, but there is some tension
between them....

Back to the question:

-table- and -tabdisp- are often alternatives to -tabulate-.

Another answer is this. Much of the problem here arises from
long numeric identifiers that users want Stata to treat
exactly. Fair enough. Try converting them to string
variables.

With Maarten's test data

tostring x, gen(sx)
tabulate sx

works as you would wish. That's not a complete solution,
but it is a useful trick also with other commands. I don't
think it will solve all of the difficulties with large
integer weights.

Nick
[email protected]

Richard Ohrvall

I have had the same problem as Jennifer when I was using a dataset
with populationweights for a population of approx. 10 millions. Since
I wanted to export the results to Excel I used the -parmby- command,
available on SSC, see -ssc desc parmest-, see also
http://www.cpc.unc.edu/services/computer/presentations/statatutorial/example27.html.
Depending on how you want to use your results, that could be solution.

However, it seems really strange that you can't get the results
without scientific notation. As shown in the example provided by
Marten, the figures becomes rounded and that is even more annoying.
Surely there most be a way to get the results without scientific
notation in the result window without using any ado-files, or?

Richard

Maarten buis

> > I had some variable values that were quite long (9905002006 for
> > example) that were showing up in scientific notation when I did
> > tab <variable> on them. I wanted them to not show up in scientific
> > notation and I wanted to be able to get a frequency table.
> >
> > A statalister suggested that the problem was not with tab command
> > display, but rather with the format of the variable. So, I changed
> > the format of the variable with:
> >
> > format <variable> %10.0f
> >
> > That resolved my problems then (thanks again).
> >
> > However, the example I gave you above is actually 1-2 digits longer
> > than the example that I posted and had resolved (so I had a 8 or 9
> > digit length variables before and used %8.0f and %9.0f and that
> > resolved things).
> >
> > Now that my numbers have gone up a placeholder, adjusting the
> > formatting to %10.0f doesn't work for the tab format. Oddly, with the
> > %10.0f formatting, I can list without values without scientific
> > notation, but if I do tab, it goes into scientific notation.
>
> I can reproduce that behavior, see the example below. One solution is
> Paul Bern's -bigtab- package, available on ssc (see: -ssc desc
> bigtab-).
>
> *------------- begin example ----------
> drop _all
> input double x
> 9905002005
> 9905002006
> end
> format x %10.0f
> tab x
> bigtab x
> *--------------- end example -----------
> (For more on how to use examples I sent to the Statalist, see
> http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

> BTW. are you aware that your variable should be stored as a double? If
> you don't understand what I am talking about I strongly urge you to
> have a look at: http://www.ats.ucla.edu/stat/Stata/faq/longid.htm

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