/*
  pctile

*! VERSION 1.1.0  19nov2004

*/

VERSION 9.0

INCLUDE _std_medium
INCLUDE _ht270
INCLUDE header

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

DIALOG main, label("pctile - Create variable containing percentiles")	///
	tabtitle("Main")
BEGIN
  INCLUDE _exp_vareq
  DEFINE _x _lft
  DEFINE _y _ls
  DEFINE _cx _iwd
  INCLUDE _type

  GROUPBOX gb_opt          @         _xls      _iwd      _ht11,		///
	label("Options")
  CHECKBOX ck_nquant       _indent   _ms       _ckwd     .,		///
	onclickon(main.sp_nquant.enable)				///
	onclickoff(main.sp_nquant.disable)
  DEFINE _x @x
  SPINNER  sp_nquant       _cksep    @         _spwd     .,		///
	label("Number of quantiles")					///
	min(2) max(100) default(2) option(nquantiles)
  TEXT     tx_nquant       _spsep   @         _cksprb    .,		///
	label("Number of quantiles")

  CHECKBOX ck_genp         _x        _ls       _ibwd     .,		///
	label("New variable to be generated containing percentages:")	///
	onclickon(main.ed_genp.enable)					///
	onclickoff(main.ed_genp.disable)
  EDIT     ed_genp         _indent2  _ss       _vnwd     .,		///
	label("New variable to be generated containing percentages")	///
	max(32) option(genp)

  CHECKBOX ck_altdef       _x        _ls       _ibwd     .,		///
	label("Use alternative formula for calculating percentiles")	///
	onclickon(program disable_weights)				///
	onclickoff(program enable_weights)				///
	option(altdef)
END

INCLUDE ifin
INCLUDE weights_fpa

INCLUDE _type_list_fd

PROGRAM command
BEGIN
	put "pctile "
	INCLUDE _type_pr
	INCLUDE _exp_vareq_pr
	INCLUDE  _weights_pr
	INCLUDE _ifin_pr
	beginoptions
		if main.ck_nquant {
			optionarg main.sp_nquant
		}
		if main.ck_genp {
			optionarg main.ed_genp
		}
		option main.ck_altdef
	endoptions
END
