/*
  heckprob

*! VERSION 1.2.5  23aug2010

  keyword:  eclass

*/

VERSION 12.0

INCLUDE _std_xlarge
DEFINE _dlght 400
INCLUDE header
HELP hlp1, view("help heckprob")
RESET res1

SCRIPT PREINIT
BEGIN
	script se_createAsSvyJknifeBstrapML
	program svy_check_title
END

SCRIPT POSTINIT
BEGIN
	script sub_set_by_on
	program se_setFinalInitState
END

SCRIPT svy_is_on
BEGIN
	rpt.gb_tests.disable
	rpt.ck_noskip.disable
	script max_setDefaultNoLog
END
SCRIPT svy_is_off
BEGIN
	rpt.gb_tests.enable
	rpt.ck_noskip.enable
	script max_setDefaultLog
END
PROGRAM svy_check_title
BEGIN
	if __MESSAGE.contains("-svy-") {
		call settitle "svy: heckprob - Probit model with sample selection for survey data"
	}
END

DIALOG main, tabtitle("Model")					///
	/// **** has svy title ****				///
	title("heckprob - Probit model with sample selection")
BEGIN
  INCLUDE heckman_model
END

INCLUDE heckman_model_sc

INCLUDE sub_by_ifin_over_subpop
INCLUDE weights_fpi
INCLUDE se

SCRIPT rpt_POSTINIT
BEGIN
	create STRING rpt_bu_fmtcoefResults
	program rpt_bu_fmtcoef_ckResults
END

DIALOG rpt, tabtitle("Reporting")
BEGIN
  DEFINE _x _lft
  DEFINE _cx _spr2b
  DEFINE _y _top
  INCLUDE _sp_level

  CHECKBOX ck_first  _lft      _ls      _cwd1      .,			/*
		*/ label("Report first-step probit estimates")		/*
		*/ option("first")					/*
		*/

  GROUPBOX gb_tests  _lft      _ls    _iwd       _ht2,			/*
  		*/ label("Additional test statistics")
  CHECKBOX ck_noskip _ilft     _ss      _cwd2      .,			/*
		*/ label("Perform likelihood-ratio test")		/*
		*/ option("noskip")					/*
		*/

  DEFINE _x _lft
  DEFINE _y _xls
  DEFINE _cx _iwd
  INCLUDE _nocnsreport

  DEFINE _x _lft
  DEFINE _y _ms
  DEFINE _cx _iwd
  INCLUDE _noomitted

  DEFINE _x _lft
  DEFINE _y _ms
  DEFINE _cx _iwd
  INCLUDE _vsquish

  DEFINE _x _lft
  DEFINE _y _ms
  DEFINE _cx _iwd
  INCLUDE _factor_vars_reporting

  DEFINE _x _lft
  DEFINE _y _xxxls
  INCLUDE _bu_coef_table_reporting
END

INCLUDE fmt_coef_table_reporting_pr

PROGRAM rpt_output
BEGIN
	optionarg /hidedefault rpt.sp_level
	option rpt.ck_first
	option rpt.ck_noskip
	INCLUDE _nocnsreport_pr
	INCLUDE _noomitted_pr
	INCLUDE _vsquish_pr
	INCLUDE _factor_vars_reporting_pr
	put " " rpt_bu_fmtcoefResults
END

INCLUDE max_ml

PROGRAM command
BEGIN
	put /program by_output " "
	put /program se_prefix_output " "
	put "heckprob "
	put " " /program heckman_model_output
	put " " /program ifin_output
	put " " /program weights_output
	beginoptions
		put " " /program heckman_model_opts_output
		put " " /program se_output
		put " " /program rpt_output
		put " " /program max_output
	endoptions
END
