Herve STOLOWY <[email protected]>:
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 <[email protected]> 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/