Statalist


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

Re: st: Number of observations in a matrix -codebook- -makematrix-


From   "Austin Nichols" <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Number of observations in a matrix -codebook- -makematrix-
Date   Wed, 9 Apr 2008 14:07:28 -0400

Herve STOLOWY <stolowy@hec.fr>:
I don't see why you have to put a scalar value in a matrix to export a
table, but you can:

sysuse auto
qui tab make if fore==0
mat f=`=r(r)'
mat li f

or if there are very many distinct values:

sysuse auto
ssc inst distinct
distinct make if fore==0
mat f=`=r(ndistinct)'
mat li f


On Wed, Apr 9, 2008 at 1:52 PM, Herve STOLOWY <stolowy@hec.fr> wrote:
> Dear Statalisters:
>
> I have a sample with 403 companies and 822 observations (several years per company). I would like to report the 403 figure in a matrix (to export it later in  a table).
>
> With the following command,
> codebook name if country=="GBR" & post_ifrs==1 & ib_scaled!=. & ib_scaled2!=. & sample_sum==1
> I get the correct figure for unique values (403). However, I don't find this figure in the return list.
>
> With -tabulate- and the following command:
> tabulate name if country=="GBR" & post_ifrs==1 & ib_scaled!=. & ib_scaled2!=. & sample_sum==1
>
> I get the correct figure in the return list: r(r)
>
> I then tried the following command with -makematrix- (downloadable from ssc):
>
> makematrix c1, from(r(r)) label listwise: tabulate name if country=="GBR" & post_ifrs==0 & ib_scaled!=. & ib_scaled2!=. & sample_sum==1
>
> I get an error message: too many values.
>
> Would you have an idea about how to get the 403 figure in a matrix?
>
> Best regards
>
> Herve Stolowy
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index