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

From |
"Nick Cox" <[email protected]> |

To |
<[email protected]> |

Subject |
st: RE: Number of observations in a matrix -codebook- -makematrix- |

Date |
Wed, 9 Apr 2008 19:04:42 +0100 |

Here is one way to get that number into a matrix: count if country=="GBR" & post_ifrs==1 & ib_scaled!=. & ib_scaled2!=. & sample_sum==1 mat A = J(1,1,.) mat A[1,1] = r(N) If -count- catches duplicates, do this downstream of a use of -egen, tag()-. If you use -makematrix- you need to use the -vector- option. But doing it directly looks easier to me. Nick [email protected] Herve STOLOWY 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? * * 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/

**References**:**st: Number of observations in a matrix -codebook- -makematrix-***From:*"Herve STOLOWY" <[email protected]>

- Prev by Date:
**st: Number of observations in a matrix -codebook- -makematrix-** - Next by Date:
**Re: st: Number of observations in a matrix -codebook- -makematrix-** - Previous by thread:
**st: Number of observations in a matrix -codebook- -makematrix-** - Next by thread:
**Re: st: Number of observations in a matrix -codebook- -makematrix-** - Index(es):

© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |