Statalist The Stata Listserver


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

Re: st: How to spolit variable info to multiple variables


From   SamL <saml@demog.berkeley.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How to spolit variable info to multiple variables
Date   Sun, 11 Feb 2007 02:27:38 -0800 (PST)

Try the -tab- command.  Specifically, if I have variable Married, which
has several categories (say, 1, 2, 3, 4, and 5), I can type:

tab1 Married, generate(marx)

and that will produce 5 variables, marx1, marx2, marx3, and so on, with
marx1=1 for all cases where Married=1, and so on.

Hope this helps.
Sam

On Sun, 11 Feb 2007, Pritpal Marjara wrote:

> Dear All,
>
> Is there any command in stata that can make separate variables for multiple
> coded responses.
>
> For example:
>
> VarA (numerical field) is coded with following responses:
>
> 145
> 235
> 1256
> 16
> 14
>
> Now I want to create six variables with the names VarA1 VarA2 VarA3 VarA4
> VarA5 VarA6 and the data from VarA to be transferred/copied to the newly
> created variables (sysmis, if the variable has no code for the new variable;
> VarA2 VarA3 and  VarA6 will have missing values for first row of VarA).
>
> Wondering, if any stata command/program can be used to do it as I have too
> many variables to recode.
>
> Thank you
>
> Pritpal
>
>
>
> -----Original Message-----
> From: Nick Cox [mailto:n.j.cox@durham.ac.uk]
> Sent: Friday, February 09, 2007 4:24 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: RE: accessing first stage results in xtivreg2
>
>
> Just one oblique comment: -xtivreg2- is a user-written command.
> (Statalist FAQ advice is that you make that clear in postings.)
> Broadly speaking, there is no commitment by StataCorp to
> provide guidance in their FAQs on user-written commands. Occasionally,
> user commands are mentioned, but any expectation of provision of extra help
> in those FAQs misunderstands their purpose.
>
> Nick
> n.j.cox@durham.ac.uk
>
> Craig A. Depken, II
>
> > I am frustrated in searching the FAQ for the answer to my question.
> > If I have missed the relevant post, I apologize.
> >
> > I am estimating a linear model in xtivreg2 with the following
> > structure
>
> *
> *   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/
>
> *
> *   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/
>
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index