Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: dialog box programming


From   "Steichen, Thomas" <STEICHT@rjrt.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: dialog box programming
Date   Wed, 16 Jul 2003 09:10:30 -0400

Sophie --

In -DIALOG main- you need to identify the name of each
option by adding the option() statement... for example:

 TEXT tx_alpha  10 10 30 . , label("Alpha (2-sided)")
 EDIT ed_alpha +20  @  @ . , label("alpha") default(0.05) 

becomes:

 TEXT tx_alpha  10 10 30 . , label("Alpha (2-sided)")
 EDIT ed_alpha +20  @  @ . , label("alpha") default(0.05) option("alpha")


Then in -PROGRAM command-, replace all those -put- statements with
an options block:

  put "sampinter "
  beginoptions
    optionarg main.ed_alpha
    optionarg main.ed_power
    optionarg main.ed_delta
    optionarg main.ed_pcontrol
    optionarg main.ed_t1
    optionarg main.ed_t2
    optionarg main.ed_a1
  endoptions


You can also use the -require- statement to replace all those
-stopbox- sections:

  require main.ed_delta main.ed_t1 main.ed_t2 main.ed_a1

This will automatically generate stopboxes for these edits. To 
get more informative messages, use the error() statement on the
edit control definition. For example:

 TEXT tx_alpha  10 10 30 . , label("Alpha (2-sided)")
 EDIT ed_alpha +20  @  @ . , label("alpha") default(0.05)   ///
                             option("alpha") error("alpha")



I note that your -HELP- button is likely incorrect...

  HELP   hlp1, label("Help") view("help Sample Size")
  
The view() option should name the help file to be opened:

  HELP   hlp1, label("Help") view("help sampinter")


Lastly, I note that -sampinter- options tau(), q1(), and u() 
are not yet implemented in the dialog.

You'll likely need to do some repositioning of controls because
the locations specified will likely cause overlap.

Tom

> -----Original Message-----
> From: Friederike Barthel [mailto:FriederikeB@ctu.mrc.ac.uk] 
> Sent: Wednesday, July 16, 2003 5:16 AM
> To: 'statalist@hsphsun2.harvard.edu'
> Subject: st: dialog box programming
> 
> 
> Dear List
> 
> I have written a dialog box program to operate an ado file 
> with the syntax:
> 
> program define sampinter, rclass
> 
> version 7.0
> 
> syntax, Alpha (numlist>0) Power (numlist>0) Delta (numlist 
> >0) [Tau (numlist
> >0)] Pcontrol (numlist >=0 <=1) [ Q1(numlist >=0 <=1)] t1(numlist > 0)
> t2(numlist > 0) [a1(numlist >0 )] [u(numlist > 0)]
> 
> 
> 
> However, when i operate the dialog box, the box itself works, 
> but on feeding the information into the sampinter program, it 
> issues the following error:
> 
> . sampinter, alpha(`main.ed_alpha') power(`main.ed_power') 
> delta(`main.ed_delta
> > ') pcontrol(`main.ed_pcontrol') t1(`main.ed_t1') t2(`main.ed_t2')
> a1(`main.ed
> > _a1')
> 
> option alpha() required
> r(198);
> 
> 
> Does anyone know a solution to the problem?
> 
> Thank you
> 
> Sophie 
> 
> 
> dialog box program:
> 
> /*
> basicdlg
> 
> VERSION 1.0 SB 04Jun2003.
> 
> Sample Size: With interaction
> 
> keyword: rclass
> 
> */
> 
> VERSION 8.0
> 
> POSITION . . 490 370
> 
> DIALOG main, title("Basic sample size calculation") 
> BEGIN
> 	TEXT tx_alpha 10  10 30 . , label("Alpha (2-sided)")
> 	EDIT ed_alpha    +20 @  @  . , label("alpha") default(0.05)
> 
> 	TEXT tx_power 40  10 30 . , label("Power")
> 	EDIT ed_power    +20 @  @  . , label("power") default(0.8)
> 
> 	TEXT tx_hratio 10  30 30 . , label("Hazard ratio")
> 	EDIT ed_delta    +20 @  @  . , label("hratio")
> 
> 	TEXT tx_pcontrol 40  30 30 . , label("Allocation")
> 	EDIT ed_pcontrol    +20 @  @  . , label("allocation") 
> default(0.5)
> 
> 	TEXT tx_t1 10  50 30 . , label("Accrual period")
> 	EDIT ed_t1    +20 @  @  . , label("accrual")
> 
> 	TEXT tx_t2 40  50 30 . , label("Follow-up period")
> 	EDIT ed_t2    +20 @  @  . , label("follow")
> 
> 	TEXT tx_a1 10  70 30 . , label("Median Survival")
> 	EDIT ed_a1    +20 @  @  . , label("a")
> END
> 
> OK     ok1, label("OK")
> CANCEL can1, label("Cancel")
> HELP   hlp1, label("Help") view("help Sample Size")
> RESET  res1
> 
> PROGRAM command
> BEGIN
> 
> 	if !(main.ed_delta) {
> 		stopbox stop "You must specify a hazard ratio!"
> 	}
> 
> 	if !(main.ed_t1) {
> 		stopbox stop "You must specify the length of accrual
> period!"
> 	}
> 
> 	if !(main.ed_t2) {
> 		stopbox stop "You must specify the length of 
> follow up period!"
> 	}
> 
> 	if !(main.ed_a1) {
> 		stopbox stop "You must specify the median survival!"
> 	}
> 
> 	put "sampinter"
> 
> 	put ", "
> 
> 	put "alpha(`main.ed_alpha') "
> 
> 	put "power(`main.ed_power') "
> 
> 	put "delta(`main.ed_delta') "
> 
> 	put "pcontrol(`main.ed_pcontrol') "
> 
> 	put "t1(`main.ed_t1') "
> 
> 	put "t2(`main.ed_t2') "
> 
> 	put "a1(`main.ed_a1') "
> 
> END
> 
> 	
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 

-----------------------------------------
CONFIDENTIALITY NOTE:  This e-mail message, including any
attachment(s), contains information that may be confidential,
protected by the attorney-client or other legal privileges, and/or
proprietary non-public information.  If you are not an intended
recipient of this message or an authorized assistant to an intended
recipient, please notify the sender by replying to this message and

then delete it from your system.  Use, dissemination, distribution,
or reproduction of this message and/or any of its attachments (if
any) by unintended recipients is not authorized and may be unlawful.


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index