Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Supertitle/Column equation labels in -xml_tab-


From   Zurab Sajaia <[email protected]>
To   statalist <[email protected]>
Subject   RE: st: Supertitle/Column equation labels in -xml_tab-
Date   Mon, 15 Feb 2010 23:01:38 -0500

Hi Marshall,

You
were almost there, using ceq() was the correct way to do it, options
cnames() and ceq() give you two levels of titles (and you'll need to
use -showeq- option as well). So here's the modified part of your
options:
 
... ceq("`l'" "`l'" "`l'" "`l'" "All HS" "All HS" "All
HS" "All HS") cnames ("Never" "Rarely" "Sometimes" "Always" "Never"
"Rarely" "Sometimes" "Always") showeq ...

Hope this helps,
zurab

> Date: Thu, 11 Feb 2010 12:05:44 -0600
> Subject: st: Supertitle/Column equation labels in -xml_tab-
> From: [email protected]
> To: [email protected]
> 
> Hello-
> 
> I'm using the user-written -xml_tab- to produce summary statistics
> tables within a -foreach- loop for multiple campuses. At the top of
> the table, I would like to insert a row that includes a title for each
> of the two sets of summary statistics that I'm reporting in the table.
> Each set of summary statistics includes four categories (Rarely,
> Never, Sometimes, Always). One set of summary statistics includes
> aggregated summary statistics across all of the levels (schools)
> included in my loop. Thus, the label will be static, something to the
> effect of "All Schools". The other set, however, should be dynamic and
> include the title for the specific campus in each stage of the loop.
> 
> I can't seem to do this in -xml_tab- using a combination of -rnames-
> and -ceq-. Currently, my clumsy and cluttered solution is to append
> the campus and "All HS" label to each of the four categories reported
> (see syntax below for -rnames-). To avoid this redundancy, I would
> rather insert a new row with column titles that span each set of
> summary statistics. Can anyone provide any guidance as to how to do
> this?
> 
> My data are arranged like this:
> 
> Student	school	 Year	var_1_never	var_1_rarely	var_1_occasionally	var_1_always
> 1      	A	2007	0	1	0	0
> 2      	A	2008	0	1	0	0
> 4      	B	2008	0	1	0	0
> 5      	B	2007	0	1	0	0
> 7      	C	2007	0	1	0	0
> 8      	C	2008	0	1	0	0
> 
> 
> Thanks in advance.
> 
> -Marshall
> 
> Link to -xml_tab-: http://ideas.repec.org/c/boc/bocode/s456760.html
> Link to Stata Journal article($):
> http://www.stata-journal.com/article.html?article=dm0037
> 
> local table_q46_jc "q9_1_recode_dummy*"
> tabstat `table_q46_jc' if survey_year==2009, save
> tabstatmat table_q46_jc
> matrix TAB_jc=table_q46_jc
> 
> local table_q46_pub "q9_2_recode_dummy*"
> tabstat `table_q46_pub' if survey_year==2009, save
> tabstatmat table_q46_pub
> matrix TAB_pub=table_q46_pub
> 
> local table_q46_priv "q9_3_recode_dummy*"
> tabstat `table_q46_priv' if survey_year==2009, save
> tabstatmat table_q46_priv
> matrix TAB_priv=table_q46_priv
> matrix table46_combined=(TAB_jc\TAB_pub\TAB_priv)
> 
> levelsof school_name, local(levels)
> quietly foreach l of local levels {
> 	tabstat `table_q46_jc' if school_name=="`l'", save
> 	tabstatmat table_q46_jc`l'
> 	matrix TAB_jc`l'=table_q46_jc`l'
> 	tabstat `table_q46_pub' if school_name=="`l'", save
> 	tabstatmat table_q46_pub`l'
> 	matrix TAB_pub`l'=table_q46_jc`l'
> 	tabstat `table_q46_priv' if school_name=="`l'", save
> 	tabstatmat table_q46_priv`l'
> 	matrix TAB_priv`l'=table_q46_priv`l'
> 	matrix table46_combined`l'=(TAB_jc`l'\TAB_pub`l'\TAB_priv`l')
> 	xml_tab table46_combined`l' table46_combined, save (`working'`l'.xml)
> sheet(tableunkown) ///
> 	append format((S2110) (S2210 N2203)) ///
> 	lines(COL_NAMES 2 LAST_ROW 3) font("Times New Roman" 12) ///
> 	rnames ("Public junior or community college" "Public 4-year" "Private
> 4-year") ///
> 	cnames ("`l' Never" "`l' Rarely" "`l' Sometimes" "`l' Always" "All HS
> Never" "All HS Rarely" "All HS Sometimes" "All HS Always")
> }
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
 		 	   		  
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index