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

Re: AW: st: Opening Stata datasets from windows explorer in windows vista

From   Sergiy Radyakin <>
Subject   Re: AW: st: Opening Stata datasets from windows explorer in windows vista
Date   Wed, 5 Aug 2009 16:18:14 -0400

Maxim is facing the problem where Stata can't open a file
double-clicked in Windows Vista.

Most of the programs in Windows open their files automatically when
launched with a filename parameter:
notepad myfile.txt
and in the registry one can see smth like: notepad %1, where %1 will
be substituted with the filename when a file is double-clicked.

Stata does not do it. Instead it treats the parameter as a COMMAND,
not the file name. So Maxim needs to supply the command "use" before
So that Windows get's this when a dta file is double-clicked:
"C:\Program Files\Stata12\wsestata.exe" use "%1"
(adjusted for the version in the path and executable name).

To try it, he could copy his data file to Stata's home directory,
shell to command line, change the current dir to Stata's home

Start the first command (replace wsestata.exe with appropriate executable name):
wsestata.exe mydata.dta
(this should reproduce Maxim's situation)
Start the second command:
wsestata.exe use mydata.dta
(the file should be open in Stata now)

To fix the situation:
1) Maxim can launch Stata and select "Restore file associations" from
2) Stata developers could analyze the filename supplied and see if it
qualifies as a valid Stata dataset (this is not possible to detect in
100% cases, but, say, in ~99%) and open it if it is, otherwise treat
the parameter as a command.

Second way may cause some compatibility problems with other
applications which may depend on the current Stata behavior, but is
possible e.g. if the filename is a full path (since no Stata commands
may contain \ in their name, and in Windows a full path will contain
C:\ (or another disk name)). Based on the slash one can determine if
it is a file or a command, based on extension determine which command
to automatically insert: use, do, etc. But then there are arguments
regarding platforms and versions compatibility, etc.

Another reason is that Maxim may have not enough priveleges to change
the registry settings to properly bind files in Windows. Maxim can ask
his system administrator to start Stata in the admin mode (right
click, select "Start as...") and restore file associations.

It is unlikely that the problem is related to Windows Vista or Stata
itself, but is rather caused by some sort of configuration/registry

Best wishes, Sergiy Radyakin

On Wed, Aug 5, 2009 at 1:19 PM, Jeanne Sears<> wrote:
> I am using Stata 9.2 on Vista. I just tried to re-create this behavior, but
> do not have this problem. So it must not be as general a problem as you are
> thinking.
> --Jeanne
> Date: Mon, 03 Aug 2009 19:07:58 -0400
> From: Maksim L Pinkovskiy <maxim09@MIT.EDU>
> Subject: Re: AW: st: Opening Stata datasets from windows explorer in windows
> vista
> Dear everyone,
>    Thank you very much for your replies. First, I am sorry, but for some
> inexplicable reason, the first line of my original email got cut off -- I
> use
> Stata 9. I have actually contacted Stata tech support on this matter, but
> they
> were unable to help me.
>    I think my problem is a general problem for Stata on Vista, rather than
> something idiosyncratic to my computer. I am wondering if there are any
> Stata
> users running Stata on Windows Vista who have encountered this problem and
> who
> have dealt with it. I have tried associating .dta files with other programs,
> but the problem is that Windows Vista does not (at least to my knowledge)
> allow
> me to specify which executable file (rather than application), rather than
> which
> program, to use in opening such files.
> Yours Sincerely,
> Maxim Pinkovskiy.
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

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