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]

st: Need Help using putexcel command for tabulate in survey setting


From   "Dudekula, Anwar" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Need Help using putexcel command for tabulate in survey setting
Date   Sat, 5 Apr 2014 16:58:00 +0000

Hi Everyone, 

I need help with exporting results from tabulate command by using putexcel command in survey setting 


I have a survey datasets with a string variable.I am trying to perform oneway tabulation and use putexcel 
My goal is to put the various string values (for the string variable) in column A and their weighted count in column B in excel sheet. 

To demonstrate it, I am using the nhanes dataset and the code is as follows 

***************code Start*********************************
webuse nhanes2f, clear
decode race, gen(s_race)  // we generate a string varaible  for demonstration purpose 
svy, subpop(sex): tabulate s_race, count  missing format(%11.3g) // I wanted to  use tabulate s_race 

*	Now I am trying to use the estimated results to put into the excel cells 
mat x = e(b)'
mat y=e(Rows)'
putexcel A1=("STRING_VAR")  B1=("COUNT") A2=matrix(e(Rows)') B2=matrix (e(b)') using results , modify 
***************code End*********************************

* however , I get the excel file with following results. 

STRING_VAR	COUNT
1		0.095615161
2		0.025368614
3		0.879016225


However What I am looking for is something like 

STRING_VAR	COUNT
Black		        Weighted count of Black
White		Weighted count of White	
Other		Weighted count of Other	



Can anyone of the stata gurus in this forum help me getting the desired results.  I thank you very much for your time and effort. 



Thank you, 
Yours Sincerely, 
Anwar Dudekula




*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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