Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: using information from value label to generate new variables
From
daniel klein <[email protected]>
To
[email protected]
Subject
Re: st: using information from value label to generate new variables
Date
Fri, 8 Jun 2012 11:39:15 +0200
Nick is, of course, right. There are still limits in what can be
stored in r(), but these are the limits of macros in Stata, and it is
unlikely to hit them here. Stata's limits are documented in -help
limits-. As a side issue on strings, let me tell you that at the
German Stata Users Group meeting there was a question about the 244
character limits in strings. Bill Gould answered that question very
quickly, annoncing that "We'll fix that.".
As -labellist- is part of the -labutil2- package (SSC) , Evelyn may
use -labcpy- to get rid of the 5-diget regional codes in value labels.
Typing
labcpy location location2 (10000/99999 = .) ,val(a1-a9)
will create <location2> as a new value label with all 5-diget regional
code labels removed. The label will be attached to variables <a1-a9>.
Best
Daniel
--
Daniel Klein, the author of -labellist- (SSC), may want to comment,
but he did exactly the right thing in defining -labellist-'s saved
results.
Evelyn's problem arise from using an equals sign in
quietly: labellist locations
local loc_levels= r(locations_values)
Evelyn should have gone
quietly: labellist locations
local loc_levels `r(locations_values)'
The equals sign evaluates the expression to its right, and that
truncates it. Here copying alone is sufficient. For more on this
biting beast, see
SJ-8-4 pr0045 . . . . . . . . Stata tip 70: Beware the evaluating equal sign
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
Q4/08 SJ 8(4):586--587 (no commands)
tip explaining the pitfall of losing content in a macro
because of limits on the length of string expressions
Nick
[email protected]
*
* 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/