/*
  vwls	

*! VERSION 1.0.4  23aug2010

  keyword:  eclass

*/

VERSION 12.0

INCLUDE _std_medium
DEFINE _dlght 300
INCLUDE header

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

DIALOG main, label("vwls - Variance-weighted least squares") tabtitle("Model")
BEGIN
  TEXT tx_dv 		_lft	_top	_vnwd	.,			///
	label("Dependent variable:")
  VARNAME vn_dv		@ 	_ss	@	.,			///
	label("Dependent variable")

  TEXT tx_iv		_vlx	_top	160	.,			///
	label("Independent variables:")
  VARLIST vl_iv		@	_ss	_vlwd	.,			///
	fv 								///
	allowcat							///
	label("Independent variables")

  CHECKBOX ck_nocons @         _ms       @         .,			/*
		*/ label("Suppress constant term")			/*
		*/ option("noconstant")					/*
		*/

  CHECKBOX ck_sd     _lft      _ls       _iwd      .,			/*
 */ label("Use variable containing estimate of conditional std. deviation") /*
		*/ clickon("gaction main.vn_sd.enable")			/*
		*/ clickoff("gaction main.vn_sd.disable")		/*
		*/
  VARNAME  vn_sd     _cksep    _ss       _vnwd     .,			/*
		*/ label("Conditional std. deviation variable")		/*
		*/ option(sd)						/*
		*/
END

INCLUDE byifin
INCLUDE weights_f

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 20
  INCLUDE _sp_level

  DEFINE _x _lft
  DEFINE _y _ls
  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 command
BEGIN
	INCLUDE _by_pr
	put "vwls "
	varlist main.vn_dv 
	varlist main.vl_iv
	INCLUDE _weights_pr
	INCLUDE _ifin_pr
	beginoptions
		option main.ck_nocons
		if main.ck_sd {
		  if !main.vn_sd {
		    stopbox stop `""Conditional std. deviation variable" is selected, but has not been filled in."'
		  }
		  optionarg main.vn_sd			
		}
		optionarg /hidedefault rpt.sp_level
		INCLUDE _noomitted_pr
		INCLUDE _vsquish_pr
		INCLUDE _factor_vars_reporting_pr
		put " " rpt_bu_fmtcoefResults
	endoptions
END
