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]

Re: st: Dialog box for opening a file

From   Alan Riley <>
Subject   Re: st: Dialog box for opening a file
Date   Thu, 28 Mar 2013 09:45:23 -0500

David Epstein ( reports that his original
dialog (.dlg) file still has a problem, and asks a question about
an alternative approach:
> Thanks very much to Alan for the response. In my original file, I did
> not have a line break in the TEXT field, so that's not the problem for
> me. I'm confused, then, as to why the code worked for you and not for
> me. Perhaps it's the fact that I'm on a Mac, rather than a Windows
> machine??

This shouldn't affect how the dialog works -- they are designed
to be platform independent.  I actually tried your dialog under
Linux, and it worked there.  Contact our Technical Services group
at and attach your file, and they can
help debug what is going on.

> And I will check out the window fopen approach again, but I thought
> that it wouldn't work since I'm opening a .csv file rather than a
> Stata .dta file. Is this not a limitation?

The example in -help window fopen- is for a .dta file, but
-window fopen- can be used to open files of any type.  Here is
an example of it for use with .csv files.  It uses the -insheet-
command with the options you were wanting your dialog to put
on the command line:

    program opencsv
        version 12
        capture window fopen FNAME "Select a file to open:" ///
                "CSV Files (*.csv)|*.csv|All Files (*.*)|*.*" csv 
        if _rc==0 { 
            display "User chose $FNAME as the filename."
            insheet using "$FNAME", names clear

*   For searches and help try:

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