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

st: macro & file name

From   Caleb Southworth <>
Subject   st: macro & file name
Date   Fri, 3 Oct 2008 09:41:11 -0700 (PDT)

I misunderstand something about the way locals are identified. The below program crashes when I try to -use- the filename in `r(files)'. If I take out the path name and change into that directory, then the program runs. How can I make this work with the path name? What is the proper way to use a local that is appended to another string, such as the path? Thanks!

. fs c:\union_pop\orig\gifford*.dta

. foreach file in `r(files)'{
2. use "c:\union_pop\orig\""`file'", clear
3. ds _*
4. foreach var of varlist `r(varlist)'{
5. bysort id: assert `var'==. if `var'[_n+1]!=.
6. }
7. }
invalid '"gifford_2000.dta'

end of do-file


* For searches and help try:

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