Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: QUestion using -fs- package

From   "Nuno Soares" <>
To   <>
Subject   st: QUestion using -fs- package
Date   Tue, 8 Jun 2010 21:11:29 +0100

Hi everyone,

I'm using the -fs- command to look into a directory for several files, open
them, insert a new variable with the file name, and save them. The code is
the following:

qui fs *.dta
foreach f in `r(files)' {
	use `f', clear
	cap drop file
	gen file=`f'		
	save, replace

However, when I run the code I get the following error code:
wscopear:  operator invalid

Basically the gen file=`f' command is returning the above error. Any way of
doing what it is intended to do?

All the best,


*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index