/*
  tabulate1

*!  VERSION 1.1.3  21aug2006

*/

VERSION 9.0

INCLUDE _std_medium
INCLUDE header

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

DIALOG main, label("tabulate1 - One-way tables") tabtitle("Main")
BEGIN
  TEXT     tx_var    _lft      _top      195       .,			/*
		*/ label("Categorical variable:")			/*
		*/
  VARNAME  vn_var    @         _ss       _vnwd     .,			/*
		*/ label("Categorical variable")			/*
		*/

  TEXT     tx_subpop +200     _top       195       .,			/*
		*/ label("Subpopulation variable: (optional)")		/*
		*/
  VARNAME  vn_subpop @         _ss       _vnwd     .,			/*
		*/ label("Subpopulation variable")			/*
		*/ option("subpop")					/*
		*/

  CHECKBOX ck_miss   _lft      _ls       _iwd      .,			/*
		*/ label("Treat missing values like other values")	/*
		*/ option("missing")					/*
		*/
  CHECKBOX ck_nofreq @         _ms       @         .,			/*
		*/ label("Do not display frequencies")			/*
		*/ option("nofreq")					/*
		*/
  CHECKBOX ck_nolab  @         _ms       @         .,			/*
		*/ label("Display numeric codes rather than value labels") /*
		*/ option("nolabel")					/*
		*/
  CHECKBOX ck_plot   @         _ms       @         .,			/*
	*/ label("Produce a bar chart of the relative frequencies")	/*
		*/ option("plot")					/*
		*/
  CHECKBOX ck_sort   @         _ms       @         .,			/*
	*/ label("Display the table in descending order of frequency")	/*
		*/ option("sort")					/*
		*/
END

INCLUDE byifin
INCLUDE weights_fai

DIALOG adv, label("") tabtitle("Advanced")
BEGIN
  TEXT     tx_gen    _lft      _top      _iwd      .,			/*
*/ label("Supply a stub to generate indicator variables for each category:")/*
		*/
  EDIT     ed_gen    _lft      _ss       _vnwd     .,			/*
		*/ label("stub")					/*
		*/ max(32)						/*
		*/ option("generate")					/*
		*/

  TEXT     tx_matcel _lft      _ls       _iwd      .,			/*
		*/ label("Generate a matrix with the cell frequencies:")/*
		*/
  EDIT     ed_matcel _lft      _ss       _vnwd     .,			/*
		*/ label("Matrix of cell frequencies")			/*
		*/ max(32)						/*
		*/ option("matcell")					/*
		*/

  TEXT     tx_matrow _lft      _ls       _iwd      .,			/*
		*/ label("Generate a matrix with the row values:")	/*
		*/
  EDIT     ed_matrow _lft      _ss       _vnwd     .,			/*
		*/ label("Matrix of row values")			/*
		*/ max(32)						/*
		*/ option("matrow")					/*
		*/

END

PROGRAM command
BEGIN
	put /program by_output " "
	put "tabulate "
	varlist main.vn_var
	put " " /program weights_output
	put " " /program ifin_output
	beginoptions
		optionarg main.vn_subpop
		option main.ck_miss
		option main.ck_nofreq
		option main.ck_nolab
		option main.ck_plot
		option main.ck_sort
		optionarg adv.ed_gen
		optionarg adv.ed_matcel
		optionarg adv.ed_matrow
	endoptions
END
