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

st: RE: RE: reshaping with many variables

From   "Radu Ban" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: reshaping with many variables
Date   Fri, 17 Oct 2003 23:31:48 +0100

hi luciana,

i brought the same issued up last month on the list and it was promptly
answered by Nick Cox. basically the problem is you have to list all
stubs, as the varlist abreviation rules don't work for the stubs.

you can take a look at:

which details the problem.

or to cut to the chase, following Nick's advice:

*put all the needed future in a local macro
unab mylist: q*_1

*note that you only need one set of stubs, so that's why you don't use
both 1 and 2

*cut out the "_1" at the end to obtain the actual stubs
foreach v of local mylist {
	local stubs `"`stubs' `=substr("`v'",1,length("`v'")-2)'"' 

*reshape (assuming you have a unique identifier "id")
reshape long `stubs', i(id) j(index) string

*where index will be a new string variable with entries _1 and _2, hence
the string *option

i do hope this helps


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of SURAN,
Sent: 17 October 2003 22:52
To: '[email protected]'
Subject: st: RE: reshaping with many variables 

Thanks for the quick response. 
I tried using the ? wildcard term, but I get an error message. For
example, I specified q???_ and the error message says "no xij variables
found."  Does anyone know why this would occur?

Thanks again,

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index