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/