levelsof hhid, local(lev)
foreach h of local lev {
unique id if hhid==`h' /* make this "`h'" if hhid is string */
}
Hope this helps
David
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Shige Song
Sent: 19 April 2006 15:58
To: [email protected]
Subject: st: "unique" with "by"
Dear Collegues,
I want to get count of unique values of a variable and I want to use it
conjuction with "by" like this:
sort hhid
by hhid: unique id
But unfortunately the UNIQUE command does not allow the use of "by".
Are there other options? Thanks!
Best,
Shige
*
* 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/
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
*
* 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/