Statalist


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

st: once again -reshape- and labels


From   Andrea Bennett <mac.stata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: once again -reshape- and labels
Date   Mon, 16 Jun 2008 18:20:08 +0200

Dear Statalisters,

I thought I should be able to succeed myself in doing a -reshape long- and preserve the variable's label, e.g. I have Ax1 Ax2 Ax3 with every Ax1-Ax3 having the very same label, but even though having a look at http://www.stata.com/support/faqs/data/variables.html and trying to borrow from there, I couldn't get it to work. I now have stored the first variable's label of each variable I need to reshape (e.g. the label for Ax1 Bx1 Cx1) but cannot get it applied to the new variables (after reshape) which are called Ax, Bx and Cx.

My code so far:

local lrshp "Ax1 Bx1 Cx1"

foreach v of var `lrshp' {
local l`v' : variable label `v'
if `"`l`v''"' == "" {
local l`v' "`v'"
}
}


Does any of you macro masters have a good line of help?

Many thanks for your consideration,

Andrea


P.S. If someone got an idea for automatically renaming Ax, Bx and Cx to A, B, and C, that would be great, too.
*
* 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