Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Data files and DOS (!) names


From   [email protected] (Alan Riley)
To   [email protected]
Subject   st: Re: Data files and DOS (!) names
Date   Tue, 01 Apr 2003 09:30:22 -0600

Patrick Joly ([email protected]) wrote
> Why is Stata now using DOS names rather the full names of data files when
> one double-clicks on a .dta icon (Win2k)?  Seems like a step backward to me
> (I thought we had been freed of DOS!!).  This wouldn't be so terrible if
> Stata didn't clobber the filename altogether during a subsequent -save,
> replace-.

What Patrick is reporting appears to be controlled by Windows rather
than Stata.  Like Patrick, I work on a Win2k machine, but when I
double-click on a long filename in a long path, the filename passed
to Stata by Windows is NOT the DOS-compatible one that Patrick is seeing,
What I get is the long file name that Patrick would like to see.  We
have seen this same preferred behavior on other computers with other
variants of Windows such as XP in tests this morning.

As of right now, I don't have an answer for Patrick about the behavior
he is seeing.  We will continue to look at the issue to try to reproduce
it here and to provide instructions to tell Windows not to pass
old-style DOS-compatible filenames to Stata.


If you are not interested in details about the way Windows knows to
call Stata to -use- a dataset when a user double-clicks on it, you may
stop reading now.

How does Windows know to call Stata when a file ending with the
".dta" extension, and how does Windows know to pass Stata the
command -use "<filename>"-?  The answer lies in the Windows registry,
where most system settings and application preferences are stored.

There is a section of the Windows registry where filetype associations
are stored.  The first time Stata runs, or when a user selects
"Restore File Associations" from the "Prefs" menu in Stata, Stata
creates some entries in this registry section to tell Windows how to
handle the various Stata filetypes.

For Stata datasets, the extension is .dta.  Stata creates a key in
the registry with the name of the extension and with the value
"Stata8Data" to identify it:

     .dta        Stata8Data

Now, when Windows sees a file ending with the .dta extension, it knows
it is of type Stata8Data.  But, what does that mean?  In another
section of the registry, applications can store instructions for
Windows to follow when it wants to do certain things with a file
such as opening it.  Some common actions that can be associated with
filetypes are "open", "edit", and "print", and the default action is
typically "open".  The default action is the one that is executed
when a user double-clicks on a file.  The other actions may be seen
when a user right-clicks on a file.  For the filetype Stata8Data, the
only action for which we give instructions to Windows is "open".

In this section of the registry, we tell Windows that the "open"
action is defined for the filetype Stata8Data, and that the
action to be executed for "open" is

    c:\stata\wstata.exe /m1 use "%1"

Let's break this down into its components:

    c:\stata\wstata.exe     The path and name of the executable to
                            launch when a .dta file is double-clicked.
                            This may of course vary depending on
                            where Stata has been installed and which
                            flavor of Stata has been installed.

    /m1                     A command-line option to Stata telling it to
                            allocate 1 megabyte of memory when starting.

    use "%1"                The command Windows is to pass to Stata.
                            Windows replaces the %1 with the full path
                            and filename on which the user has double-
                            clicked.

It is important to note about the -use- command that Stata has no
control over what Windows substitutes in places of the "%1".  On my
computer, I am seeing Windows substitute

   C:\My Projects\Profitability\Presentations\GCR01Innov_cap.DTA

for the %1.  (I created a path and file on my Windows 2000 machine
to simulate Patrick's path and file.)

Patrick is seeing Windows substitute

   P:\MYPROJEC\PROFITAB\PRESEN~1\GCR01I~1.DTA

for the %1, which is unfortunate.

I note that the drive on which GCR01Innov_cap.DTA is stored for
Patrick is labelled with the letter "P", which is an indication
that it is probably a network drive.  This is the major difference
I can see between the experiment I set up on my computer and
Patrick's setup.  I am curious as to whether this might be a clue
to the reason why Windows is choosing to pass a DOS-style filename
to Stata rather than the real full Windows filename.

I suspect that if this is not related to a network drive, that there
may be some obscure Windows setting which may be controlling this
behavior.  We have done some research, but have not been able to
find any information on such a setting.  I invite anyone who may be
experiencing similar behavior to Patrick to email me, and I also would
like to hear from anyone who might have a guess as to what is causing
this behavior on Patrick's computer.


--Alan
([email protected])
*
*   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/



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