/*
	centile

*! VERSION 1.1.0  23may2007

*/

VERSION 10.0

INCLUDE _std_medium
INCLUDE header
HELP hlp1, view("help centile")
RESET res1

PROGRAM POSTINIT_PROGRAM
BEGIN
	if __MESSAGE.iseq("-cii-") {
		call opt.rb_cci.seton
	}
END

DIALOG main,label("centile - Report centile and confidence interval")/*
		*/	tabtitle("Main")
BEGIN
  /*--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+*/
   TEXT	    tx_var        _lft	    _top      _iwd	.,            /*
		*/	label("Variables: (leave empty for all)")

   VARLIST  vl_var        @         _ss       @         .,            /*
                */      label("Variables")

   TEXT	    tx_exp        @         _ms       _cwd1     .,            /*
		*/	label("Examples:")

   TEXT	    tx_xy         _ilft     _vss      _cwd4_2   .,            /*
		*/	label("yr*")

   TEXT	    tx_all        _lft4_2   @         _comb4_1  .,            /*
		*/      label(`"All variables starting with "yr""')

   TEXT	    tx_abc        _ilft     _vss      _cwd4_2   .,            /*
	        */      label("xyz-abc")

   TEXT	    tx_xyz        _lft4_2   @         _comb4_1  .,    	      /*
		*/	label("All variables between xyz and abc")


   TEXT     tx_centile    _lft      _xls      _ibwd     .,            /*
                */      label("Centiles:")

   EDIT     ed_centile    @         _ss       _ibwd     .,            /*
                */      label("Centile numlist")                      /*
                */      default(50)                                   /*
                */      option(centile)
   TEXT     tx_cexp       _lft      _ms       _cwd1     .,            /*
                */      label("Examples:")

   TEXT     tx_cn         _indent   _vss      _cwd4_2   .,            /*
                */      label("1/3")
   DEFINE holdx @x
   TEXT     tx_three      _lft4_2   @         _comb4_1  .,            /*
                */      label("Three numbers from 1 to 3 (1, 2, 3)")
   TEXT     tx_four       holdx     _vss      _cwd4_2   .,            /*
                */      label("1(2)7 ")
   TEXT     tx_fn         _lft4_2   @         _comb4_1  .,            /*
                */      label("Four numbers (1, 3, 5, 7)")
END

INCLUDE byifin

DIALOG opt, tabtitle("Options")
BEGIN

   GROUPBOX gb_interval   _lft      _top      _iwd      _ht8,         /*
                */      label("Confidence interval")

   RADIO    rb_default    _ilft     _ss       _ibwd     .,            /*
                */ label("Binomial interpolated")                     /*
                */ first                                              /*
                */ option("NONE")

   RADIO    rb_cci        @         _ss       _ibwd     .,            /*
                */ label("Binomial exact (conservative confidence interval)")/*
                */ option(cci)

   RADIO    rb_normal     @         _ss       @         .,            /*
                */ label("Normal, based on observed centiles")        /*
                */ option(normal)

   RADIO    rb_meansd     @         _ss       @         .,            /*
	 */ label("Normal, based on mean and standard deviation")     /*
		*/ last                                               /*
                */ option(meansd)

   DEFINE   _x _lft
   DEFINE   _cx _spr
   DEFINE   _y +45
   INCLUDE  _sp_level
END

PROGRAM command
BEGIN
	INCLUDE _by_pr
	put "centile "
	varlist [main.vl_var]
	INCLUDE _ifin_pr
	beginoptions
		optionarg main.ed_centile
		option radio(opt rb_default rb_cci rb_normal rb_meansd)
		INCLUDE _level_opt_pr
	endoptions
END

