Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: -contract- hard-coded to generate frequencies with datatype long, can result in missing
From
László Sándor <[email protected]>
To
[email protected]
Subject
Re: st: -contract- hard-coded to generate frequencies with datatype long, can result in missing
Date
Thu, 9 May 2013 18:39:39 -0400
Aaaand, my bad again. -collapse- with (count) will count only
nonmissing observations, while -contract- does count observations
where any of the byvars are missing (though drops zero-frequency
cells). So I will need an auxiliary variable for collapse to work,
then.
And I forgot to mention fweights in my collapse example, of course,
which are key to my use case, but work with both contract and
collapse.
On Thu, May 9, 2013 at 6:34 PM, László Sándor <[email protected]> wrote:
> Hi all,
>
> This is just a public service announcement, so you won't lose the
> better half of your workday like I just did:
>
> -contract- seems a nifty little official command for a single purpose,
> but bit me hard: it is hard-coded to generate frequencies with the
> data type long, which can then silently flip over to missing if you
> have big data with more than 2 billion observations (probably coming
> from fweights from aggregates though, as in my case).
>
> Probably -collapse (count) _freq=byvar1, by(byvar1 byvar2)- is the way
> to go. I just knew -collapse- does not like string variables, but for
> byvars it does.
>
> My bad.
>
> Laszlo
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/