Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: unique value count in several variables

From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: unique value count in several variables
Date   Sat, 18 Jun 2005 16:52:12 +0100

By "unique" here I think you mean "distinct". 

Try -groups- from SSC. Or -egen, group()- 
and then tabulate. 

[email protected] 

Wanli Zhao
> I have a simple question but got stuck on a simple solution. 
> I have a panel
> and let's say cross-section id is gvkey and time id is year. 
> There are two
> variables, say, primary sic and secondary sic. My aim to 
> count the unique
> value of sic in both variables by gvkey by year. I know the 
> 'by' thing is
> straightforward but is there a quick solution to count the unique
> observation in both variables? I know the commands such as 
> unique, distinct
> and egenmore nvals. They work perfect for a single variable. 
> Also, on the
> webpage there is a explanation of the unique combination of 
> two variables and how to count that. I guess mine is different. Your help 
> is appreciated.

*   For searches and help try:

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