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]

st: Dialog box for opening a file

From   David Epstein <>
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:



POSITION . . 410 250

DIALOG main, label("Daily Data Processing") tabtitle("Main")
  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|*.*")

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

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

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.


*   For searches and help try:

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