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, **statalist.org** is already up and running.

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

From |
"Michael N. Mitchell" <Michael.Norman.Mitchell@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: QUestion using -fs- package |

Date |
Tue, 08 Jun 2010 13:31:30 -0700 |

Dear Nuno

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

note : This comes from the `f' data file I hope that helps, Michael N. Mitchell Data Management Using Stata - http://www.stata.com/bookstore/dmus.html A Visual Guide to Stata Graphics - http://www.stata.com/bookstore/vgsg.html Stata tidbit of the week - http://www.MichaelNormanMitchell.com On 2010-06-08 1.11 PM, Nuno Soares wrote:

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 r(198); Basically the gen file=`f' command is returning the above error. Any way of doing what it is intended to do? All the best, Nuno * * 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/

**Follow-Ups**:**RE: st: QUestion using -fs- package***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**References**:**st: QUestion using -fs- package***From:*"Nuno Soares" <ndsoares@gmail.com>

- Prev by Date:
**st: RE: QUestion using -fs- package** - Next by Date:
**RE: st: QUestion using -fs- package** - Previous by thread:
**st: RE: QUestion using -fs- package** - Next by thread:
**RE: st: QUestion using -fs- package** - Index(es):