Statalist


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

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


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: workaround for macro length problem with levelsof() ?
Date   Sat, 23 Feb 2008 22:20:30 +0000 (GMT)

--- Daniel Waxman <dan@amplecat.com> wrote:
> 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'"
> 	...
> 	}
> 

I am not able to reproduce your problem:

*--------- begin example -------------
sysuse nlsw88, clear
levelsof idcode, local(namelist)
foreach name of local namelist {
	di "`name'"
}
*--------- end example ---------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

-- Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      __________________________________________________________
Sent from Yahoo! Mail.
A Smarter Inbox. http://uk.docs.yahoo.com/nowyoucan.html
*
*   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