Quantcast

Create Dummy Variable

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Create Dummy Variable

Hobst
I have a Variable called New_Brand, it consists of 56 different Brand names. Is there a command, which lets me create a dummy variable for each of the brand? Sorry for the noob question, but i dont get it.
I tried it with foreach but didnt get it right
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

AW: Create Dummy Variable

Martin Weiss-5

<>


See - h xi-, -h fvvarlist- or -h tab- with the -gen()- option.



HTH
Martin


-----Urspr√ľngliche Nachricht-----
Von: [hidden email]
[mailto:[hidden email]] Im Auftrag von Hobst
Gesendet: Dienstag, 29. Juni 2010 18:19
An: [hidden email]
Betreff: st: Create Dummy Variable

I have a Variable called New_Brand, it consists of 56 different Brand names.
Is there a command, which lets me create a dummy variable for each of the
brand? Sorry for the noob question, but i dont get it.
I tried it with foreach but didnt get it right
--
View this message in context:
http://statalist.1588530.n2.nabble.com/Create-Dummy-Variable-tp5235676p52356
76.html
Sent from the Statalist mailing list archive at Nabble.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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Create Dummy Variable

Nick Cox
In reply to this post by Hobst
-tabulate new_brand, gen()-

Or just use factor variable notation.

Nick
[hidden email]

Hobst

I have a Variable called New_Brand, it consists of 56 different Brand
names.
Is there a command, which lets me create a dummy variable for each of
the
brand? Sorry for the noob question, but i dont get it.
I tried it with foreach but didnt get it right

*
*   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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AW: Create Dummy Variable

Hobst
In reply to this post by Martin Weiss-5
the gen() option worked out great. Thank you. Is it also possible, that these newly generated variables are named after the brand name in new_brand? instead of name1, name1, etc
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Re: AW: Create Dummy Variable

Nick Cox
That depends on whether those names could be legal variable names. You
are better off getting the real names into variable labels.

(It's best not to delete what you are replying to. That's over-zealous,
although sometimes better than the opposite extreme of deleting
nothing.)

Nick
[hidden email]

Hobst

the gen() option worked out great. Thank you. Is it also possible, that
these
newly generated variables are named after the brand name in new_brand?
instead of name1, name1, etc

*
*   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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: RE: Re: AW: Create Dummy Variable

Nick Cox
See also -dummieslab- from SSC.

Nick
[hidden email]


-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Nick Cox
Sent: 29 June 2010 17:52
To: [hidden email]
Subject: st: RE: Re: AW: Create Dummy Variable

That depends on whether those names could be legal variable names. You
are better off getting the real names into variable labels.

(It's best not to delete what you are replying to. That's over-zealous,
although sometimes better than the opposite extreme of deleting
nothing.)

Nick
[hidden email]

Hobst

the gen() option worked out great. Thank you. Is it also possible, that
these
newly generated variables are named after the brand name in new_brand?
instead of name1, name1, etc

*
*   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/
Loading...