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: Use extended functions outside of macro assignment?

From   James Sams <>
Subject   st: Use extended functions outside of macro assignment?
Date   Tue, 6 Sep 2011 15:06:20 -0500

I keep running into situations where I would like to use an extended function 
as a part of a function call, e.g. in a conditional statement. I thought I had 
seen syntax to do this before, but I cannot find this now.

For example, let's say I wanted to operate on a set of observations dependent 
upon some characteristic of a value label, say that the value label matches 
some regular expression. How can I do this? I specifically cannot pull the value 
label into a string variable with decode due to the size of the dataset:

Something like this:
list if regexm("`: label (varname)'", "my_regex")

or say I want to operate on a set of ids I have stored in a local macro "ids":

list if `: list posof id in ids'

James Sams
*   For searches and help try:

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