Dear Statalisters,
I want to build a complex table for my presentation that includes a major summary of different variables. For example, I want to show the top three vegetables grown by the farmers in a column. For each of these vegetables, I would like to present different information in rows. The first row could contain the percent of farmers growing these vegetable crops. The second row could show the average yield for these three vegetable products, the third row could show the total turnover, and so on. The idea is to build a single table with the use of more than one command. I would like to do this within STATA without exporting individual results to excel and without (probably) deleting some of the rows and combining excel outputs.
Can anyone guide me with the steps to build a table this way. Technically, I have two data sets, the first data set consists of the list of vegetable crops grown by the farmers. It has a list of top 3 vegetables that farmers grow. It is a kind of multiple response dataset in polytomous mode from which the top three vegetables grown by the farmers and the percentage of farmers growing these vegetables can be pulled.
The second data set is a long data simulated with additional information on yield and turnover of these vegetable crops. From this dataset, I need to pull information on average yield and total turnover of the top 3 crops.
Here is an example dataset:
I want to build a complex table for my presentation that includes a major summary of different variables. For example, I want to show the top three vegetables grown by the farmers in a column. For each of these vegetables, I would like to present different information in rows. The first row could contain the percent of farmers growing these vegetable crops. The second row could show the average yield for these three vegetable products, the third row could show the total turnover, and so on. The idea is to build a single table with the use of more than one command. I would like to do this within STATA without exporting individual results to excel and without (probably) deleting some of the rows and combining excel outputs.
Can anyone guide me with the steps to build a table this way. Technically, I have two data sets, the first data set consists of the list of vegetable crops grown by the farmers. It has a list of top 3 vegetables that farmers grow. It is a kind of multiple response dataset in polytomous mode from which the top three vegetables grown by the farmers and the percentage of farmers growing these vegetables can be pulled.
The second data set is a long data simulated with additional information on yield and turnover of these vegetable crops. From this dataset, I need to pull information on average yield and total turnover of the top 3 crops.
Here is an example dataset:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float id byte crop1 int crop2 byte crop3 1 1 23 10 2 10 23 5 3 6 1 3 4 1 5 3 5 5 3 1 6 23 3 1 7 5 10 3 8 10 6 5 9 5 1 6 10 1 10 5 11 1 5 14 12 14 1 3 13 10 1 3 14 1 5 3 15 5 3 1 end label values crop1 A1_2 label values crop2 A1_2 label values crop3 A1_2 label def A1_2 1 "Tomato", modify label def A1_2 5 "Cabbage", modify label def A1_2 6 "Cucumber", modify label def A1_2 10 "Beans", modify label def A1_2 14 "Green Leaves", modify label def A1_2 23 "Pumpkin", modify label def A1_2 3 "Cauliflower", modify label var crop1 "Top three crops grown by farmers" label var crop2 "Top three crops grown by farmers" label var crop3 "Top three crops grown by farmers" // The next set of data has been created by making the data long and adding some variables reshape long crop, i(id) j(top_veg) set seed 789 gen yield = runiformint(100,1000) gen turnover = yield*1500*runiform(0,1)+4