Few updates to wave.do

Few updates to wave.do

onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate -expand -group {clock and reset} -radix hexadecimal /top_tb/T1/clk
add wave -noupdate -expand -group {clock and reset} -radix hexadecimal /top_tb/T1/reset
add wave -noupdate -expand -group pc -radix hexadecimal /top_tb/T1/curr_pc_top
add wave -noupdate -expand -group pc -radix hexadecimal /top_tb/T1/next_pc_top
add wave -noupdate -expand -group pc -radix hexadecimal /top_tb/T1/next_seq_pc_top
add wave -noupdate -expand -group pc -radix hexadecimal /top_tb/T1/next_jmp_pc_top
add wave -noupdate -expand -group pc -radix hexadecimal /top_tb/T1/next_beq_pc_top
add wave -noupdate -expand -group pc -radix hexadecimal /top_tb/T1/next_brn_eq_pc_top
add wave -noupdate -expand -group instr -radix hexadecimal /top_tb/T1/instr_top
add wave -noupdate -expand -group instr -radix hexadecimal /top_tb/T1/funct_top
add wave -noupdate -expand -group instr -radix hexadecimal /top_tb/T1/op_top
add wave -noupdate -expand -group instr /top_tb/T1/sign_ext_top
add wave -noupdate -expand -group instr /top_tb/T1/is_r_type_top
add wave -noupdate -expand -group instr /top_tb/T1/is_i_type_top
add wave -noupdate -expand -group instr /top_tb/T1/is_j_type_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/reg_src_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/reg_dst_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/jump_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/branch_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/mem_read_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/mem_to_reg_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/alu_op_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/mem_wr_top
add wave -noupdate -expand -group control /top_tb/T1/alu_src_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/reg_wr_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/sign_ext_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/use_link_reg_top
add wave -noupdate -expand -group alu -radix hexadecimal /top_tb/T1/r_data_p1_top
add wave -noupdate -expand -group alu -radix hexadecimal /top_tb/T1/r_data_p2_top
add wave -noupdate -expand -group alu /top_tb/T1/n_top
add wave -noupdate -expand -group alu -radix hexadecimal /top_tb/T1/res_alu_top
add wave -noupdate -expand -group rf -radix hexadecimal /top_tb/T1/rd_top
add wave -noupdate -expand -group rf -radix hexadecimal /top_tb/T1/rs_top
add wave -noupdate -expand -group rf -radix hexadecimal /top_tb/T1/rt_top
add wave -noupdate -expand -group rf -radix hexadecimal /top_tb/T1/r_data_p1_top
add wave -noupdate -expand -group rf -radix hexadecimal /top_tb/T1/r_data_p2_rf_top
add wave -noupdate -expand -group rf -radix hexadecimal /top_tb/T1/wr_data_rf_top
add wave -noupdate -expand -group rf /top_tb/T1/rs_dec_top
add wave -noupdate -expand -group rf -radix hexadecimal /top_tb/T1/rd_dec_top
add wave -noupdate -radix hexadecimal /top_tb/T1/sign_imm_top
add wave -noupdate -radix hexadecimal /top_tb/T1/target_top
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/opr_a_alu_i
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/opr_b_alu_i
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/op_alu_i
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/cin_alu
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/opr_b_negated_alu
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/adder_out_alu
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/carry_out_alu
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/shifter_out_alu
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/logical_out_alu
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/res_alu_o
add wave -noupdate -group {alu block} /top_tb/T1/A1/n_alu_o
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/z_alu_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/alu_op_ctl_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/alu_src_ctl_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/branch_ctl_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/controls
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/instr_funct_ctl_i
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/instr_op_ctl_i
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/jump_ctl_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/mem_read_ctl_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/mem_to_reg_ctl_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/mem_wr_ctl_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/reg_dst_ctl_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/reg_wr_ctl_o
add wave -noupdate -group {control block} /top_tb/T1/C1/sign_ext_ctl_o
add wave -noupdate -group {rf block} -radix hexadecimal /top_tb/T1/R1/clk
add wave -noupdate -group {rf block} -radix hexadecimal /top_tb/T1/R1/reset
add wave -noupdate -group {rf block} -radix hexadecimal /top_tb/T1/R1/r_reg_p1_rf_i
add wave -noupdate -group {rf block} -radix hexadecimal /top_tb/T1/R1/r_data_p1
add wave -noupdate -group {rf block} -radix hexadecimal /top_tb/T1/R1/r_data_p1_rf_o
add wave -noupdate -group {rf block} -radix hexadecimal /top_tb/T1/R1/r_reg_p2_rf_i
add wave -noupdate -group {rf block} -radix hexadecimal /top_tb/T1/R1/r_data_p2
add wave -noupdate -group {rf block} -radix hexadecimal /top_tb/T1/R1/r_data_p2_rf_o
add wave -noupdate -group {rf block} -radix hexadecimal /top_tb/T1/R1/w_reg_rf_i
add wave -noupdate -group {rf block} -radix hexadecimal /top_tb/T1/R1/w_en_rf_i
add wave -noupdate -group {rf block} -radix hexadecimal /top_tb/T1/R1/w_data_rf_i
add wave -noupdate -group {rf block} -radix hexadecimal /top_tb/T1/R1/reg_file
add wave -noupdate -group {decode block} -radix hexadecimal /top_tb/T1/D1/funct_dec_o
add wave -noupdate -group {decode block} -radix hexadecimal /top_tb/T1/D1/instr_dec_i
add wave -noupdate -group {decode block} -radix hexadecimal /top_tb/T1/D1/is_i_type_dec_o
add wave -noupdate -group {decode block} -radix hexadecimal /top_tb/T1/D1/is_j_type_dec_o
add wave -noupdate -group {decode block} -radix hexadecimal /top_tb/T1/D1/is_r_type_dec_o
add wave -noupdate -group {decode block} -radix hexadecimal /top_tb/T1/D1/op_dec_o
add wave -noupdate -group {decode block} -radix hexadecimal /top_tb/T1/D1/rd_dec_o
add wave -noupdate -group {decode block} -radix hexadecimal /top_tb/T1/D1/rs_dec_o
add wave -noupdate -group {decode block} -radix hexadecimal /top_tb/T1/D1/rt_dec_o
add wave -noupdate -group {decode block} -radix hexadecimal /top_tb/T1/D1/shamt_dec_o
add wave -noupdate -group {decode block} -radix hexadecimal /top_tb/T1/D1/sign_imm_dec_o
add wave -noupdate -group {decode block} -radix hexadecimal /top_tb/T1/D1/target_dec_o
add wave -noupdate -group {decode block} -radix hexadecimal /top_tb/T1/D1/use_link_reg_dec_o
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {53 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 282
configure wave -valuecolwidth 187
configure wave -justifyvalue left
configure wave -signalnamewidth 0
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 1
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ps
update
WaveRestoreZoom {0 ps} {110 ps}

onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate -expand -group {clock and reset} -radix hexadecimal /top_tb/T1/clk
add wave -noupdate -expand -group {clock and reset} -radix hexadecimal /top_tb/T1/reset
add wave -noupdate -expand -group pc -radix hexadecimal /top_tb/T1/curr_pc_top
add wave -noupdate -expand -group pc -radix hexadecimal /top_tb/T1/next_pc_top
add wave -noupdate -expand -group pc -radix hexadecimal /top_tb/T1/next_seq_pc_top
add wave -noupdate -expand -group pc -radix hexadecimal /top_tb/T1/next_jmp_pc_top
add wave -noupdate -expand -group pc -radix hexadecimal /top_tb/T1/next_beq_pc_top
add wave -noupdate -expand -group pc -radix hexadecimal /top_tb/T1/next_brn_eq_pc_top
add wave -noupdate -expand -group instr -radix hexadecimal /top_tb/T1/instr_top
add wave -noupdate -expand -group instr -radix hexadecimal /top_tb/T1/funct_top
add wave -noupdate -expand -group instr -radix hexadecimal /top_tb/T1/op_top
add wave -noupdate -expand -group instr /top_tb/T1/sign_ext_top
add wave -noupdate -expand -group instr /top_tb/T1/is_r_type_top
add wave -noupdate -expand -group instr /top_tb/T1/is_i_type_top
add wave -noupdate -expand -group instr /top_tb/T1/is_j_type_top
add wave -noupdate -expand -group control /top_tb/T1/reg_src_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/reg_dst_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/jump_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/branch_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/mem_read_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/mem_to_reg_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/alu_op_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/mem_wr_top
add wave -noupdate -expand -group control /top_tb/T1/alu_src_top
add wave -noupdate -expand -group control -radix hexadecimal /top_tb/T1/reg_wr_top
add wave -noupdate -expand -group control /top_tb/T1/sign_ext_top
add wave -noupdate -expand -group control /top_tb/T1/use_link_reg_top
add wave -noupdate -expand -group alu -radix hexadecimal /top_tb/T1/r_data_p1_top
add wave -noupdate -expand -group alu -radix hexadecimal /top_tb/T1/r_data_p2_top
add wave -noupdate -expand -group alu /top_tb/T1/n_top
add wave -noupdate -expand -group alu -radix hexadecimal /top_tb/T1/res_alu_top
add wave -noupdate -expand -group rf -radix hexadecimal /top_tb/T1/rd_top
add wave -noupdate -expand -group rf -radix hexadecimal /top_tb/T1/rs_top
add wave -noupdate -expand -group rf -radix hexadecimal /top_tb/T1/rt_top
add wave -noupdate -expand -group rf -radix hexadecimal /top_tb/T1/r_data_p1_top
add wave -noupdate -expand -group rf -radix hexadecimal /top_tb/T1/r_data_p2_rf_top
add wave -noupdate -expand -group rf -radix hexadecimal /top_tb/T1/wr_data_rf_top
add wave -noupdate -expand -group rf /top_tb/T1/rs_dec_top
add wave -noupdate -expand -group rf -radix hexadecimal /top_tb/T1/rd_dec_top
add wave -noupdate -radix hexadecimal /top_tb/T1/sign_imm_top
add wave -noupdate -radix hexadecimal /top_tb/T1/target_top
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/opr_a_alu_i
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/opr_b_alu_i
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/op_alu_i
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/cin_alu
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/opr_b_negated_alu
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/adder_out_alu
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/carry_out_alu
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/shifter_out_alu
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/logical_out_alu
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/res_alu_o
add wave -noupdate -group {alu block} /top_tb/T1/A1/n_alu_o
add wave -noupdate -group {alu block} -radix hexadecimal /top_tb/T1/A1/z_alu_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/alu_op_ctl_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/alu_src_ctl_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/branch_ctl_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/controls
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/instr_funct_ctl_i
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/instr_op_ctl_i
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/jump_ctl_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/mem_read_ctl_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/mem_to_reg_ctl_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/mem_wr_ctl_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/reg_dst_ctl_o
add wave -noupdate -group {control block} -radix hexadecimal /top_tb/T1/C1/reg_wr_ctl_o
add wave -noupdate -group {control block} /top_tb/T1/C1/sign_ext_ctl_o
add wave -noupdate -expand -group {rf block} -radix hexadecimal /top_tb/T1/R1/clk
add wave -noupdate -expand -group {rf block} -radix hexadecimal /top_tb/T1/R1/reset
add wave -noupdate -expand -group {rf block} -radix hexadecimal /top_tb/T1/R1/r_reg_p1_rf_i
add wave -noupdate -expand -group {rf block} -radix hexadecimal /top_tb/T1/R1/r_data_p1
add wave -noupdate -expand -group {rf block} -radix hexadecimal /top_tb/T1/R1/r_data_p1_rf_o
add wave -noupdate -expand -group {rf block} -radix hexadecimal /top_tb/T1/R1/r_reg_p2_rf_i
add wave -noupdate -expand -group {rf block} -radix hexadecimal /top_tb/T1/R1/r_data_p2
add wave -noupdate -expand -group {rf block} -radix hexadecimal /top_tb/T1/R1/r_data_p2_rf_o
add wave -noupdate -expand -group {rf block} -radix hexadecimal /top_tb/T1/R1/w_reg_rf_i
add wave -noupdate -expand -group {rf block} -radix hexadecimal /top_tb/T1/R1/w_en_rf_i
add wave -noupdate -expand -group {rf block} -radix hexadecimal /top_tb/T1/R1/w_data_rf_i
add wave -noupdate -expand -group {rf block} -radix hexadecimal /top_tb/T1/R1/reg_file
add wave -noupdate -expand -group {decode block} -radix hexadecimal /top_tb/T1/D1/funct_dec_o
add wave -noupdate -expand -group {decode block} -radix hexadecimal /top_tb/T1/D1/instr_dec_i
add wave -noupdate -expand -group {decode block} -radix hexadecimal /top_tb/T1/D1/is_i_type_dec_o
add wave -noupdate -expand -group {decode block} -radix hexadecimal /top_tb/T1/D1/is_j_type_dec_o
add wave -noupdate -expand -group {decode block} -radix hexadecimal /top_tb/T1/D1/is_r_type_dec_o
add wave -noupdate -expand -group {decode block} -radix hexadecimal /top_tb/T1/D1/op_dec_o
add wave -noupdate -expand -group {decode block} -radix hexadecimal /top_tb/T1/D1/rd_dec_o
add wave -noupdate -expand -group {decode block} -radix hexadecimal /top_tb/T1/D1/rs_dec_o
add wave -noupdate -expand -group {decode block} -radix hexadecimal /top_tb/T1/D1/rt_dec_o
add wave -noupdate -expand -group {decode block} -radix hexadecimal /top_tb/T1/D1/shamt_dec_o
add wave -noupdate -expand -group {decode block} -radix hexadecimal /top_tb/T1/D1/sign_imm_dec_o
add wave -noupdate -expand -group {decode block} -radix hexadecimal /top_tb/T1/D1/target_dec_o
add wave -noupdate -expand -group {decode block} -radix hexadecimal /top_tb/T1/D1/use_link_reg_dec_o
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {53 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 282
configure wave -valuecolwidth 187
configure wave -justifyvalue left
configure wave -signalnamewidth 0
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 1
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ps
update
WaveRestoreZoom {0 ps} {110 ps}


iegraph : make sure that up is indeed rounded up

I remembered how to do this. Test this again. I think this should work

cap	program drop	iegraph
	program define 	iegraph
	preserve
	syntax varlist, [noconfbars TItle(string) save(string) confbarsnone(varlist) yzero *]

	mat beta_ = e(b)

	local counter = 0
	//local textfile = "Mrijan"

	qui{
		if "`confbars'" 			!= "" {
		local CONFINT_BAR 	= 0
		}
		else if "`confbars'" 			== "" {
		local CONFINT_BAR 	= 1
		}

		local varTest : list confbarsnone in varlist

		if `varTest' == 0 {
					noi display as error "{phang} Variables defined in confbarsnone cannot be found in the graph variable list. {p_end}"
					noi display ""
					error 111
					 }

		foreach var of local varlist{
			cap assert inlist(`var',0,1) | missing(`var')
				if _rc {
					noi display as error "{phang} The variable `var' is not a dummy. Treatment variable needs to be a dummy(0 or 1) variable. {p_end}"
					noi display ""
					error 149
					}
				else {
					}

		local counter = `counter' + 1
		di `counter'

		scalar coeff_`var' = _b[`var']
		//noi display coeff_`var'

		scalar coeff_se_`var' = _se[`var']
		//noi display coeff_se_`var'

		count if e(sample) == 1 & `var' == 1 //Count one tmt group at the time
		scalar obs_`var' = r(N)
		//noi display obs_`var'

	}

	local count: word count `varlist'
	local graphCount = `count' + 1
	//tokenize "`varlist'"
	//noi di `count'

	//Make all vars tempvars (maybe do later)
	//Make sure that missing is properly handled
	tempvar anyTMT
	egen `anyTMT' = rowmax(`varlist') if e(sample) == 1
	tempvar control
	gen `control' = (`anyTMT' == 0) if !missing(`anyTMT')

	sum `e(depvar)' if e(sample) == 1 & `control' == 1
	scalar ctl_N		= r(N)
	scalar ctl_mean	  	= r(mean)
	scalar ctl_mean_sd 	= r(sd)

		foreach var of local varlist {
			scalar  conf_int_min_`var'   =	coeff_`var'-(1.96*coeff_se_`var') + ctl_mean
			scalar  conf_int_max_`var'   =	coeff_`var'+(1.96*coeff_se_`var') + ctl_mean

			test `var'
			local star_`var' " "

			scalar  pvalue =r(p)
			if pvalue < 0.10 {
				local star_`var' "*"
			}
			if pvalue < 0.05 {
				local star_`var' "**"
			}
			if pvalue < 0.01 {
				local star_`var' "***"
			}
			*noi display "`star_`var''"
			scalar tmt_mean_`var' = ctl_mean + coeff_`var'
		}

	tempname 	newHandle
	tempfile	newTextFile
	cap file close 	`newHandle'
	file open  	`newHandle' using "`newTextFile'", text write append

	*Write headers and control value
	file write `newHandle' ///
		"order" 	_tab "xLabeled"	_tab "mean" _tab "coeff" _tab "conf_int_min" _tab "conf_int_max" _tab "obs" _tab "star" _n 	///
		%9.3f (1) _tab "Control"  _tab %9.3f (ctl_mean)      _tab  		 			_tab 		 			  	  _tab 			 				_tab %9.3f (ctl_N) 	   _tab			  	  _n

	tempvar newCounter
	gen `newCounter' = 2  //First tmt group starts at 2 (1 is control)

	foreach var in `varlist' {
	     if `: list var in confbarsnone' {
		file write `newHandle' ///
			%9.3f (`newCounter') _tab "`var'" _tab %9.3f (tmt_mean_`var') _tab  %9.3f (coeff_`var')  _tab %9.3f  _tab _tab %9.3f (obs_`var')   _tab "`star_`var''"  _n

		replace `newCounter' = `newCounter' + 1
			}
		else {
		file write `newHandle' ///
			%9.3f (`newCounter') _tab "`var'" _tab %9.3f (tmt_mean_`var') _tab  %9.3f (coeff_`var')  _tab %9.3f (conf_int_min_`var') _tab %9.3f (conf_int_max_`var') _tab %9.3f (obs_`var')   _tab "`star_`var''"  _n

		replace `newCounter' = `newCounter' + 1
		}
	}

	file close `newHandle'

	copy "`newTextFile'"  "mainMasterDofile.txt" , replace

	/*************************************

		Create the graph

	*************************************/

	insheet using mainMasterDofile.txt, clear

	local tmtGroupBars 	""
	local xAxisLabels 	`"xlabel( "'
	local legendLabels	`"lab(1 "`obsLabelControl'")"'
	local legendNumbers	""

	forval tmtGroupCount = 1/`graphCount' {

		************
		*Create the bar for this group

		colorPicker `tmtGroupCount' `graphCount'

		local tmtGroupBars `"`tmtGroupBars' (bar mean order if order == `tmtGroupCount', color("`r(color)'")) "'

		************
		*Create labels etc. for this group

		local obs 			= obs[`tmtGroupCount']
		local stars 		= star[`tmtGroupCount']
		local legendLabel 	= xlabeled[`tmtGroupCount']

		local xAxisLabels 	`"`xAxisLabels' `tmtGroupCount' "(N = `obs') `stars'" "'
		local legendLabels 	`"`legendLabels' lab(`tmtGroupCount' "`legendLabel'") "'
		local legendNumbers	`"`legendNumbers' `tmtGroupCount'"'
	}

	*Close or comple some strings
	local xAxisLabels `"`xAxisLabels' ,noticks labsize(medsmall)) "'
	local legendOption `"legend(order(`legendNumbers') `legendLabels')"'

	*Create the confidence interval bars
	if `CONFINT_BAR' == 0 {
		//local confIntGraph == `"(scatter mean order,  msym(none)  mlabs(medium) mlabpos(10) mlabcolor(black)), xtitle("") ytitle("`e(depvar)'") "'
		local confIntGraph = ""
	}
		else if `CONFINT_BAR' == 1 {
		local confIntGraph = `"(rcap conf_int_max conf_int_min order, lc(gs)) (scatter mean order,  msym(none)  mlabs(medium) mlabpos(10) mlabcolor(black))"'
	}

	local titleOption `" , xtitle("") ytitle("`e(depvar)'") "'

	if "`save'" != "" {
		local saveOption saving("`save'", replace)
	}

	if "`yzero'" != "" {

		gen maxvalue = max(mean , conf_int_max)

		sum maxvalue
		local max = `r(max)'

		local logmax = log10(`max')

		local logmax = round(`logmax') - 1

		local tenpower = 10 ^ (`logmax')

		local up = `tenpower' * ceil(`max' / `tenpower')

		local half = (`up') / 2

		noi di "up: `up'"
		noi di "half: `half'"

		local yzero_option ylabel(0(`half')`up')
	}

	noi di `" graph twoway `tmtGroupBars' `confIntGraph' `titleOption' `options' `legendOption' `xAxisLabels' `saveOption' title("`title'") `yzero_option'  "'
	graph twoway `tmtGroupBars' `confIntGraph' `titleOption' `options' `legendOption' `xAxisLabels' `saveOption' title("`title'") `yzero_option'
	//noi di 	`"graph twoway `tmtGroupBars' `legendOption' (scatter mean order,  msym(none)  mlabs(medium) mlabpos(10) mlabcolor(black))), xtitle("") ytitle("`e(depvar)'") `xAxisLabels' `saveOption' title("`title'")  "'

	restore
}

end

cap	program drop	colorPicker
	program define 	colorPicker , rclass

	args groupCount totalNumGroups

	if `totalNumGroups' == 2 {

		if `groupCount' == 1 return local color "215 25 28"
		if `groupCount' == 2 return local color "43 123 182"
	}
	else if `totalNumGroups' == 3 {

		if `groupCount' == 1 return local color "215 25 28"
		if `groupCount' == 2 return local color "255 255 191"
		if `groupCount' == 3 return local color "43 123 182"
	}
	else if `totalNumGroups' == 4 {

		if `groupCount' == 1 return local color "215 25 28"
		if `groupCount' == 2 return local color "255 255 191"
		if `groupCount' == 3 return local color "171 217 233"
		if `groupCount' == 4 return local color "43 123 182"
	}
	else {

		*For five or more colors we repeat the same pattern

		local colourNum = mod(`groupCount', 5)
		if `colourNum' == 1 return local color "215 25 28"
		if `colourNum' == 2 return local color "253 174 93"
		if `colourNum' == 3 return local color "255 255 191"
		if `colourNum' == 4 return local color "171 217 233"
		if `colourNum' == 0 return local color "43 123 182"

	}

end

cap	program drop	iegraph
	program define 	iegraph
	preserve
	syntax varlist, [noconfbars TItle(string) save(string) confbarsnone(varlist) yzero *]

	mat beta_ = e(b)

	local counter = 0
	//local textfile = "Mrijan"

	qui{
		if "`confbars'" 			!= "" {
		local CONFINT_BAR 	= 0
		}
		else if "`confbars'" 			== "" {
		local CONFINT_BAR 	= 1
		}

		local varTest : list confbarsnone in varlist

		if `varTest' == 0 {
					noi display as error "{phang} Variables defined in confbarsnone cannot be found in the graph variable list. {p_end}"
					noi display ""
					error 111
					 }

		foreach var of local varlist{
			cap assert inlist(`var',0,1) | missing(`var')
				if _rc {
					noi display as error "{phang} The variable `var' is not a dummy. Treatment variable needs to be a dummy(0 or 1) variable. {p_end}"
					noi display ""
					error 149
					}
				else {
					}

		local counter = `counter' + 1
		di `counter'

		scalar coeff_`var' = _b[`var']
		//noi display coeff_`var'

		scalar coeff_se_`var' = _se[`var']
		//noi display coeff_se_`var'

		count if e(sample) == 1 & `var' == 1 //Count one tmt group at the time
		scalar obs_`var' = r(N)
		//noi display obs_`var'

	}

	local count: word count `varlist'
	local graphCount = `count' + 1
	//tokenize "`varlist'"
	//noi di `count'

	//Make all vars tempvars (maybe do later)
	//Make sure that missing is properly handled
	tempvar anyTMT
	egen `anyTMT' = rowmax(`varlist') if e(sample) == 1
	tempvar control
	gen `control' = (`anyTMT' == 0) if !missing(`anyTMT')

	sum `e(depvar)' if e(sample) == 1 & `control' == 1
	scalar ctl_N		= r(N)
	scalar ctl_mean	  	= r(mean)
	scalar ctl_mean_sd 	= r(sd)

		foreach var of local varlist {
			scalar  conf_int_min_`var'   =	coeff_`var'-(1.96*coeff_se_`var') + ctl_mean
			scalar  conf_int_max_`var'   =	coeff_`var'+(1.96*coeff_se_`var') + ctl_mean

			test `var'
			local star_`var' " "

			scalar  pvalue =r(p)
			if pvalue < 0.10 {
				local star_`var' "*"
			}
			if pvalue < 0.05 {
				local star_`var' "**"
			}
			if pvalue < 0.01 {
				local star_`var' "***"
			}
			*noi display "`star_`var''"
			scalar tmt_mean_`var' = ctl_mean + coeff_`var'
		}

	tempname 	newHandle
	tempfile	newTextFile
	cap file close 	`newHandle'
	file open  	`newHandle' using "`newTextFile'", text write append

	*Write headers and control value
	file write `newHandle' ///
		"order" 	_tab "xLabeled"	_tab "mean" _tab "coeff" _tab "conf_int_min" _tab "conf_int_max" _tab "obs" _tab "star" _n 	///
		%9.3f (1) _tab "Control"  _tab %9.3f (ctl_mean)      _tab  		 			_tab 		 			  	  _tab 			 				_tab %9.3f (ctl_N) 	   _tab			  	  _n

	tempvar newCounter
	gen `newCounter' = 2  //First tmt group starts at 2 (1 is control)

	foreach var in `varlist' {
	     if `: list var in confbarsnone' {
		file write `newHandle' ///
			%9.3f (`newCounter') _tab "`var'" _tab %9.3f (tmt_mean_`var') _tab  %9.3f (coeff_`var')  _tab %9.3f  _tab _tab %9.3f (obs_`var')   _tab "`star_`var''"  _n

		replace `newCounter' = `newCounter' + 1
			}
		else {
		file write `newHandle' ///
			%9.3f (`newCounter') _tab "`var'" _tab %9.3f (tmt_mean_`var') _tab  %9.3f (coeff_`var')  _tab %9.3f (conf_int_min_`var') _tab %9.3f (conf_int_max_`var') _tab %9.3f (obs_`var')   _tab "`star_`var''"  _n

		replace `newCounter' = `newCounter' + 1
		}
	}

	file close `newHandle'

	copy "`newTextFile'"  "mainMasterDofile.txt" , replace

	/*************************************

		Create the graph

	*************************************/

	insheet using mainMasterDofile.txt, clear

	local tmtGroupBars 	""
	local xAxisLabels 	`"xlabel( "'
	local legendLabels	`"lab(1 "`obsLabelControl'")"'
	local legendNumbers	""

	forval tmtGroupCount = 1/`graphCount' {

		************
		*Create the bar for this group

		colorPicker `tmtGroupCount' `graphCount'

		local tmtGroupBars `"`tmtGroupBars' (bar mean order if order == `tmtGroupCount', color("`r(color)'")) "'

		************
		*Create labels etc. for this group

		local obs 			= obs[`tmtGroupCount']
		local stars 		= star[`tmtGroupCount']
		local legendLabel 	= xlabeled[`tmtGroupCount']

		local xAxisLabels 	`"`xAxisLabels' `tmtGroupCount' "(N = `obs') `stars'" "'
		local legendLabels 	`"`legendLabels' lab(`tmtGroupCount' "`legendLabel'") "'
		local legendNumbers	`"`legendNumbers' `tmtGroupCount'"'
	}

	*Close or comple some strings
	local xAxisLabels `"`xAxisLabels' ,noticks labsize(medsmall)) "'
	local legendOption `"legend(order(`legendNumbers') `legendLabels')"'

	*Create the confidence interval bars
	if `CONFINT_BAR' == 0 {
		//local confIntGraph == `"(scatter mean order,  msym(none)  mlabs(medium) mlabpos(10) mlabcolor(black)), xtitle("") ytitle("`e(depvar)'") "'
		local confIntGraph = ""
	}
		else if `CONFINT_BAR' == 1 {
		local confIntGraph = `"(rcap conf_int_max conf_int_min order, lc(gs)) (scatter mean order,  msym(none)  mlabs(medium) mlabpos(10) mlabcolor(black))"'
	}

	local titleOption `" , xtitle("") ytitle("`e(depvar)'") "'

	if "`save'" != "" {
		local saveOption saving("`save'", replace)
	}

	if "`yzero'" != "" {

		gen maxvalue = max(mean , conf_int_max)

		sum maxvalue
		local max = `r(max)'

		local logmax = log10(`max')

		local logmax = round(`logmax') - 1

		local tenpower = 10 ^ (`logmax')

		local up = round(`max', `tenpower')

		local half = (`up') / 2

		noi di "up: `up'"
		noi di "half: `half'"

		local yzero_option ylabel(0(`half')`up')
	}

	noi di `" graph twoway `tmtGroupBars' `confIntGraph' `titleOption' `options' `legendOption' `xAxisLabels' `saveOption' title("`title'") `yzero_option'  "'
	graph twoway `tmtGroupBars' `confIntGraph' `titleOption' `options' `legendOption' `xAxisLabels' `saveOption' title("`title'") `yzero_option'
	//noi di 	`"graph twoway `tmtGroupBars' `legendOption' (scatter mean order,  msym(none)  mlabs(medium) mlabpos(10) mlabcolor(black))), xtitle("") ytitle("`e(depvar)'") `xAxisLabels' `saveOption' title("`title'")  "'

	restore
}

end

cap	program drop	colorPicker
	program define 	colorPicker , rclass

	args groupCount totalNumGroups

	if `totalNumGroups' == 2 {

		if `groupCount' == 1 return local color "215 25 28"
		if `groupCount' == 2 return local color "43 123 182"
	}
	else if `totalNumGroups' == 3 {

		if `groupCount' == 1 return local color "215 25 28"
		if `groupCount' == 2 return local color "255 255 191"
		if `groupCount' == 3 return local color "43 123 182"
	}
	else if `totalNumGroups' == 4 {

		if `groupCount' == 1 return local color "215 25 28"
		if `groupCount' == 2 return local color "255 255 191"
		if `groupCount' == 3 return local color "171 217 233"
		if `groupCount' == 4 return local color "43 123 182"
	}
	else {

		*For five or more colors we repeat the same pattern

		local colourNum = mod(`groupCount', 5)
		if `colourNum' == 1 return local color "215 25 28"
		if `colourNum' == 2 return local color "253 174 93"
		if `colourNum' == 3 return local color "255 255 191"
		if `colourNum' == 4 return local color "171 217 233"
		if `colourNum' == 0 return local color "43 123 182"

	}

end


Make redo more user-friendly.

Make redo more user-friendly.

# Allows building ROMs even if bin isn't in path.
export PATH=$PATH:$(pwd)/bin

redo-ifchange bin/a
redo-ifchange bin/bspl.fs
redo-ifchange bin/e

redo-ifchange roms/mlm
redo-ifchange roms/ngaro

echo "Be sure to add bin/ to your \$PATH if you haven't already." >&2
echo "  export PATH=\$PATH:$(pwd)/bin" >&2


Delete 2015-05-01-Mein-erster-Eintrag.ado