Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Antwort: Re: Antwort: st: detect unique values of onevariable into a new variable


From   Richard Ochmann <rochmann@diw.de>
To   statalist@hsphsun2.harvard.edu
Subject   Antwort: Re: Antwort: st: detect unique values of onevariable into a new variable
Date   Mon, 20 Dec 2010 18:40:08 +0100

...
the use of the term "unique values" should not be the main source of 
confusion here.
you should rather describe the structure of your data and what you intend 
to do by "detect[ing] unique values".

also, you should check out Nick's comments and my approach and report if 
and why they do not return what you are looking for.

best,
rich

owner-statalist@hsphsun2.harvard.edu schrieb am 20.12.2010 18:20:45:

> I used the term "unique values" because STATA uses it when you type 
> "codebook country". I don't remember the english word for 
> "Variablen-Ausprägung", so i could not describe it better as in this 
> example. Maybe you do?
> 
> Thank you for your time.
> 
> Am 20.12.2010 18:04, schrieb Richard Ochmann:
> > ...
> > it's not entirely clear to me what you mean by "detect unique values".
> > does this give what you want?
> >
> > ***
> > gen country_unique = .
> > replace country_unique = Country if Country[_n] != Country[_n-1]
> > ***
> >
> > best,
> > rich
> >
> > owner-statalist@hsphsun2.harvard.edu schrieb am 20.12.2010 17:56:07:
> >
> >> I would like to know if and how I can detect unique values of one
> >> variable and write them into a new variable.
> >>
> >> For Example:
> >>
> >> Country
> >>
> >> Australia
> >> Australia
> >> Belgium
> >> Belgium
> >> Germany
> >>
> >> I need a variable which is:
> >> unique = "Australia" "Belgium" "Germany"
> >>
> >> I don't need:
> >> unique = "Australia" "Australia" "Belgium" "Belgium" "Germany"
> >>
> >> Thank you!
> >> *
> >> *   For searches and help try:
> >> *   http://www.stata.com/help.cgi?search
> >> *   http://www.stata.com/support/statalist/faq
> >> *   http://www.ats.ucla.edu/stat/stata/
> > *
> > *   For searches and help try:
> > *   http://www.stata.com/help.cgi?search
> > *   http://www.stata.com/support/statalist/faq
> > *   http://www.ats.ucla.edu/stat/stata/
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index