Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: Using if in list of r(...)

From   "Martin Weiss" <>
To   <>
Subject   st: AW: Using if in list of r(...)
Date   Tue, 6 Apr 2010 15:20:53 +0200


So -labelrename- is user-written by Jeroen Weesie, and obtained via -findit


-----Ursprüngliche Nachricht-----
[] Im Auftrag von Kaulisch, Marc
Gesendet: Dienstag, 6. April 2010 15:05
Betreff: st: Using if in list of r(...)

I have the following problem: I would like to have all names of value
labels starting with the same prefix "l". But some of the value labels
do have already a "l" as a prefix.

I generate the list of value labels ( r(names) )with 
label dir

But I have not found a way to select only those with
if substr("`val'",1,1) ~= "l" 

For all value labels it would look like:
foreach val in `r(names)' {
local i = "`val'" 
labelrename `i' l`i' 

But neither foreach, local nor labelrename allow for an if-option. Any
hints, ideas?



*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index