|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: macro & file name
try
use "c:\union_pop\orig\`file'", clear
Caleb Southworth wrote:
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
gifford_2000.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'
r(198);
end of do-file
r(198);
*
* 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/
*
* 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/