Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Generating Identifier based on string variable
From
Dawood Ashraf <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Generating Identifier based on string variable
Date
Tue, 8 Nov 2011 06:30:14 -0800 (PST)
Thanks Anees.
----- Original Message -----
From: Muhammad Anees <[email protected]>
To: [email protected]
Cc:
Sent: Tuesday, November 8, 2011 4:58:29 PM
Subject: Re: st: Generating Identifier based on string variable
For confirmation only, the -xtset- result as
xtset name2 date
panel variable: name2 (unbalanced)
time variable: date, 1990 to 1993
delta: 1 unit
Hope that worked for you, Dawood!
On Tue, Nov 8, 2011 at 6:54 PM, Muhammad Anees <[email protected]> wrote:
> Sorry, the first suggestion fails as the string variable is nonnumeric
> and stata would say "name contains nonnumeric characters", rather you
> can try
>
> encode name, generate(name2)
>
> On Tue, Nov 8, 2011 at 6:45 PM, Muhammad Anees <[email protected]> wrote:
>> destring name, gen(new) should do as the names appear to be string variables
>>
>> On Tue, Nov 8, 2011 at 6:41 PM, Dawood Ashraf <[email protected]> wrote:
>>>
>>> I am trying to generate a new identifier variable based on names of individuals. The shape of the data is as follows:
>>>
>>> Name Date
>>> Mark 1990
>>>
>>> Mark 1991
>>> Mark 1992
>>>
>>> Marry 1990
>>>
>>> Marry 1991
>>>
>>> Marry 1992
>>>
>>> Marry 1993
>>>
>>> Chris 1993
>>>
>>> Bob 1992
>>>
>>>
>>> Now I want to generate a new variable, Identifier which assign unique number to Mark, Marry, Chris and Bob as 1,2,3,4.
>>>
>>> I have looked in the help but could not find anything suitable. I have seen once a question similar to this on STATA and applied myself but somehow skipped from my mind. Any help will be greatly appreciated.
>>>
>>> Regards
>>>
>>> Dawood
>>>
>>>
>>> *
>>> * 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/
>>>
>>
>>
>>
>> --
>>
>> Regards
>> ---------------------------
>> Muhammad Anees
>> Assistant Professor
>> COMSATS Institute of Information Technology
>> Attock 43600, Pakistan
>> www.aneconomist.com
>>
>
>
>
> --
>
> Regards
> ---------------------------
> Muhammad Anees
> Assistant Professor
> COMSATS Institute of Information Technology
> Attock 43600, Pakistan
> www.aneconomist.com
>
--
Regards
---------------------------
Muhammad Anees
Assistant Professor
COMSATS Institute of Information Technology
Attock 43600, Pakistan
www.aneconomist.com
*
* 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/