Bookmark and Share

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]

st: macro list limits strpos


From   Jakob Petersen <[email protected]>
To   [email protected]
Subject   st: macro list limits strpos
Date   Fri, 20 Jan 2012 10:30:11 +0000

Statalist,

Problem: The following does not scale up to longer macro lists and variables at the end of longer macros are cut off.

***************************************************
sysuse auto,clear
findname,type(string) local(vstr)
findname,type(int) local(vint)
findname,local(vother)
local vother : list vother - vstr
local vother : list vother - vint
di "`vstr'"
di "`vint'"
di "`vother'"
foreach v of varlist * {
if strpos("`vstr'","`v'") {
di "`v' is a string variable"
}
if strpos("`vint'","`v'") {
di "`v' is an integer variable"
}
if strpos("`vother'","`v'") {
di "`v' is not string nor integer variable"
}
}
***************************************************

Any ideas?
Similar to: http://www.stata.com/statalist/archive/2008-01/msg00945.html

Tried increasing maxvar to no avail - is there away of increasing mem allocation here or is a different approach to -strpos- required?

Thanks,
Jakob Petersen

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index