Bookmark and Share

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]

st: Dialog box for opening a file


From   David Epstein <[email protected]>
To   [email protected]
Subject   st: Dialog box for opening a file
Date   Wed, 27 Mar 2013 14:50:09 -0400

This is a simple operation, but after hours of frustration I can't
figure out how to program a simple dialog box to open a .csv file. The
command I want to emulate is:

insheet using "myfile.csv", names clear

My dialog box program looks like this now, but I can't get Stata to
open the file:

/*
  daily_file.dlg
*/


VERSION 12

POSITION . . 410 250

DIALOG main, label("Daily Data Processing") tabtitle("Main")
BEGIN
  TEXT     tx_dly      10  40   320  .,	label("Select file with data
to be processed:")
  FILE     fi_dly      10  +30  350  .,	error("Open file") label(Browse...) ///
  			filter("CSV Files|*.csv|All Files|*.*")
END

OK ok1,      label("OK")
CANCEL can1, label("Cancel")
SUBMIT sub1, label("Submit")
HELP hlp1,   view("help generate")
RESET res1
COPY copy1

PROGRAM command
BEGIN
    put "insheet using "
    put `"""'
    require main.fi_dly
    put main.fi_dly
    put `"""'
    put ", names clear "
END

I'm guessing the problem is with my treatment of the quotation marks,
but none of the approximately one gazillion variations I've tried
works. Or perhaps it's something else basic that I've overlooked. Any
help would be appreciated.

Thanks,

David
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index