![]() ![]() The mean is stored in the scalar r(mean). I can type return list after summarize age to see a list of returned results. For example, I might wish to write the mean of age to Excel. We can write each of these to an Excel table using putexcel. Many Stata commands return scalars, macros, and matrices. I am using a subset of the data and have relabeled some of the variables so don’t be concerned if your numbers don’t match mine exactly.Įxample 1: Writing returned results to Excel You can download the dataset used in the examples by typing webuse nhanes2. You may wish to use a similar approach when creating large reports. I could create a separate Excel file for each example, but I would prefer to have a single file with multiple sheets. Putexcel set putexcel2.xlsx, sheet(example8) modify Putexcel set putexcel2.xlsx, sheet(example2) modify Putexcel set putexcel2.xlsx, sheet(example1) replace So the putexcel set commands will look like this: These are important steps toward our goal of automating the creation of reports in Excel.īefore we begin the examples, I want to point out that I am going to create a single Excel file called putexcel2.xlsx and write each example to a separate sheet within that file. I will even show you how to write formulas to Excel to create calculated cells. Today, I want to show you how to write more complex expressions such as macros, graphs, and matrices. In my last post, I showed how to use putexcel to write simple expressions to Microsoft Excel and format the resulting text and cells. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |