Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: data manipulating question


From   "Clive Nicholas" <[email protected]>
To   [email protected]
Subject   Re: st: data manipulating question
Date   Sat, 23 Oct 2004 01:13:07 +0100 (BST)

Phuong Lan Nguyen wrote:

> I have a question about stata program and I hope you are able to help me.
> I
> have a series of numeric variables and want to group them into 1
> variable. Details of my data is
>
>  	var1		var2		var3
>  	x		y		z
>
> 3 variables indicates 3 code of teaching experience of teachers. Now i
> want to
> group them into 1 variable:
>
>  	new variable
> var1 	x
> var2	y
> var3	z
>
> What command should I use to transform these variables?

If I were a betting man, I'd say -reshape- ought to do the job. Here's my
stab:

(1) Create a new column, place it to the extreme left and give that cell a
    name (let's call it -ugg-);

(2) Then:
    . reshape long new, i(ugg) j(var)

If I have it the right way around, that ought to do it.

CLIVE NICHOLAS        |t: 0(044)7903 397793
Politics              |e: [email protected]
Newcastle University  |http://www.ncl.ac.uk/geps
*
*   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