Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: workaround for macro length problem with levelsof() ?


From   "Daniel Waxman" <dan@amplecat.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: workaround for macro length problem with levelsof() ?
Date   Sat, 23 Feb 2008 16:56:57 -0500

Statalist,

I am trying to access a series of files using the values of a variable in
another dataset to as an index of the names of the files.  This is easy to
do with –levelsof-, except that the macro is truncated at a very small
number of characters (244?).

Here is what I’d like to do:

clear
insheet using sp_components.csv
keep v1
levelsof(v1), local(namelist)

foreach name of local namelist {
	clear
	local filepath = "c:/mydata/"`name'"
	insheet using "`filepath'"
	...
	}


Since I need to clear memory each time, there is no easy workaround that I
can see using -forvalues-
I can't help but think that -levelsof- wouldn't bother to generate the nice
long list that it does if there weren't some way to use it.  Am I missing
something?

Thanks.

Dan


Internal Virus Database is out-of-date.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.20.7/1283 - Release Date: 2/16/2008
2:16 PM
 


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index