Statalist The Stata Listserver


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

st: RE: "unique" with "by"


From   "David Harrison" <[email protected]>
To   <[email protected]>
Subject   st: RE: "unique" with "by"
Date   Wed, 19 Apr 2006 16:27:47 +0100

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/



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