Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Dialog box for opening a file
From
Alan Riley <[email protected]>
To
[email protected]
Subject
Re: st: Dialog box for opening a file
Date
Thu, 28 Mar 2013 09:45:23 -0500
David Epstein ([email protected]) 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 [email protected] 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
}
end
Alan
[email protected]
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/