Gabi does not state the operating system.
If it's Windows, my guess is that Stata's difficulty is that Windows
does not
seem consistent in its handling of case.
If you go through the GUI, Windows shows filenames with upper case
letters just as originally
assigned.
If you go through the command prompt or equivalent, you seem to be
dealing with something
not very different from the ancient DOS code which is not
case-sensitive.
Although it's a counsel of despair, my experience matches Friedrich's
advice: just work with
lower case filenames throughout.
Nick
[email protected]
Friedrich Huebler
One idea is to rename all do-files so that the file names only have
lowercase letters. Several free programs can help with this task, for
example Lupas Rename.
http://rename.lupasfreeware.org/
On Mon, Apr 14, 2008 at 7:05 PM, Gabi Huiber <[email protected]> wrote:
> I am having a problem with uppercase letters in file names.
>
> I am trying to impose some version control on a bunch of do-files of
> the type [filename]_yyyymmdd.do, that have been saved weekly with
> various changes over the past two years or so.
>
> In the first stage of this job I just want to read their names, then
> collect the yyyymmdd part in a matrix. But I am hitting a snag with
> files where the alphanumeric part contains uppercase characters. My
> code goes like this:
>
> ____ code snippet starts here_____
>
> local `k'list: dir "${dofrom}" files "`k'*.do" // this is the list
> of do-files that start with string "`k'_"
> local `k'clean: list clean `k'list // this strips the
> quotes around file names `k'_[...].do
> local `k'num: list sizeof `k'clean // this is the gross
> length of that list (in some cases
> di "`k'"
> di ``k'num' // it includes
> all files that start with `k'_, not strictly
> // files of
> type `k'_YYYYMMDD.do. in those cases
> // an extra
> step is needed, see below)
> matrix define `k'dates=J(``k'num',1,0) // set up empty matrix to
> collect dates of do-files
>
> _____and ends here_____________
>
> Now, for cases where this `k' local is like say "clean_report_", all
> is well. But when `k' is like "DNAreport_", I get a reading error and
> as a result ``k'num', the length of the list of do-files of interes,
> becomes zero. See this case:
>
> ______snippet of screen output starts here____
>
> clean_report_
> 13
> number of observations will be reset to 13
> Press any key to continue, or Break to abort
> obs was 0, now 13
> (0 observations deleted)
> 13
>
> clean_report_dates[13,1]
> c1
> r1 20080109
> r2 20080116
> r3 20080123
> r4 20080130
> r5 20080207
> r6 20080213
> r7 20080220
> r8 20080227
> r9 20080305
> r10 20080312
> r11 20080319
> r12 20080326
> r13 20080409
> DNAreport_
> 0
> invalid syntax
> r(198);
>
> end of do-file
> r(198);
>
> ____and ends here________
>
> I am not sure how to get Stata to recognize these file names
properly.
> I would appreciate any ideas.
>
*
* 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/