/*
    stir.dlg

*!  VERSION 1.1.1  13mar2005

*/

VERSION 9.0

INCLUDE _std_large
DEFINE _dlght 320
INCLUDE header

HELP hlp1, view("help stir")
RESET res1

DIALOG main, label("stir - Report incidence-rate comparison") tabtitle("Main")
BEGIN
  DEFINE  _x _xsetbu
  DEFINE  _y _top
  INCLUDE _bu_stset

  TEXT     tx_varexp         _lft      _top      _cwd1     .,		///
		label("Exposed variable:")
  VARNAME  vn_varexp         _lft      _ss       _vnwd     .,		///
		label("Exposed variable")

  CHECKBOX ck_strata         _lft      +35       _iwd      _ht5,	///
		label("Stratified calculation")				///
		onclickon(program main_strata_on)			///
		onclickoff(script main_strata_off)			///
		groupbox
  TEXT     tx_var            _ilft     _ms	 _inwd     .,		///
  		label("Strata ID variable:")
  VARNAME  vn_strata         @         _ss       _vnwd     .,		///
		option(strata)						///
		label("Strata ID variable")
  CHECKBOX ck_noshow         _lft      _xxls     _iwd      .,		///
		option(noshow)						///
		label("Do not show st setting information")
END

PROGRAM main_strata_on
BEGIN
	call main.vn_strata.enable
	call main.tx_var.enable
	if ! opt.rb_mstd {
		call opt.gb_report.enable
		call opt.rb_irr.enable
		call opt.rb_ird.enable
	}
	call opt.gb_std.enable
	call opt.rb_mstd.enable
	call opt.rb_istd.enable
	call opt.rb_estd.enable
	call opt.rb_vstd.enable
	call opt.ck_nocrude.enable
	call opt.ck_pool.enable
	call opt.ck_nohom.enable
END

SCRIPT main_strata_off
BEGIN
	main.vn_strata.disable
	main.tx_var.disable
	opt.gb_report.disable
	opt.rb_irr.disable
	opt.rb_ird.disable
	opt.gb_std.disable
	opt.rb_mstd.disable
	opt.rb_istd.disable
	opt.rb_estd.disable
	opt.rb_vstd.disable
	opt.ck_nocrude.disable
	opt.ck_pool.disable
	opt.ck_nohom.disable
END

INCLUDE byifin

DIALOG opt, tabtitle("Options")
BEGIN
  GROUPBOX gb_report    _lft	_top	_cwd1	_ht4,		///
  	label("Report")
  RADIO    rb_irr	_ilft	_ss	_cwd3	.,		///
  	label("Incidence-rate ratio")  first
  RADIO    rb_ird	_ilft	_ss	_cwd3	.,		///
  	label("Incidence-rate difference") last option(ird)

  GROUPBOX gb_std	_lft	_xls	_cwd1	_ht10h,		///
	label("Within-stratum weights")
  RADIO    rb_mstd	_indent	_ss	_inwd	.,		///
	first option(NONE) label("Use Mantel-Haenszel")		///
	onclickon(script mstd_on)
  RADIO    rb_estd	@	_ss	@	.,		///
	label("Use external") option(estandard)			///
	onclickon(script estd_on)
  RADIO    rb_istd	@	_ss	@	.,		///
	label("Use internal") option(istandard) 		///
	onclickon(script istd_on)
  RADIO    rb_vstd	@	_ss	@	.,		///
	last option(NONE) label("User-specified variable:")	///
	onclickon(script vstd_on)
  VARNAME  vn_vstd	_indent2 _ss	_vnwd	., 		///
	option(standard)					///
	label("Within-stratum weight variable")
  CHECKBOX ck_pool      _lft	+45	_cwd1	.,		///
	option(pool) label("Display pooled estimate")
  CHECKBOX ck_nocrude	@	_ms	@	.,		///
	option(nocrude) label("No crude estimate")
  CHECKBOX ck_nohom	@	_ms	@	.,		///
	option(nohom) label("No homogeneity test")

  CHECKBOX ck_tb        _lft2   _top    _cwd1   .,		///
	option(tb)						///
	label("Test-based conf. intervals")
  DEFINE _x _lft2
  DEFINE _y _ls
  DEFINE _cx _spr2
  INCLUDE _sp_level
END

SCRIPT mstd_on
BEGIN
	opt.gb_report.disable
	opt.rb_irr.disable
	opt.rb_ird.disable
	opt.vn_vstd.disable
END

SCRIPT estd_on
BEGIN
	opt.gb_report.enable
	opt.rb_irr.enable
	opt.rb_ird.enable
	opt.vn_vstd.disable
END

SCRIPT istd_on
BEGIN
	opt.gb_report.enable
	opt.rb_irr.enable
	opt.rb_ird.enable
	opt.vn_vstd.disable
END

SCRIPT vstd_on
BEGIN
	opt.gb_report.enable
	opt.rb_irr.enable
	opt.rb_ird.enable
	opt.vn_vstd.enable
END

PROGRAM command
BEGIN
	INCLUDE _by_pr
	put "stir "
	varlist main.vn_varexp
	INCLUDE _ifin_pr
	beginoptions
		if main.ck_strata {
			require main.vn_strata
			optionarg main.vn_strata
		}
		option main.ck_noshow
		option opt.rb_ird
		option opt.rb_istd
		option opt.rb_estd
		if opt.rb_vstd {
			require opt.vn_vstd
			optionarg opt.vn_vstd
		}
		option opt.ck_tb
		option opt.ck_pool
		option opt.ck_nocrude
		option opt.ck_nohom
		INCLUDE _level_opt_pr
	endoptions
END
