All,
Many times one may want to get information from a variable and use it dynamically in your code. There is an easy and powerful way to do this.
Let's say that I wish to have a loop based on the max of a variable you can do
sum var1
local numbr : display r(max)
forvalues i = 1(1)`numbr' {
....
}
Anything that you can "display" you can get into a macro. To see a list of what you can recover type
return list
after you do the sum or sum, detail and
ereturn list
after a regression
Showing posts with label macros. Show all posts
Showing posts with label macros. Show all posts
Monday, April 5, 2010
Subscribe to:
Posts (Atom)