Hi
I run a "by year: tab command" to get the number of households from the IPMUS CPS dataset using the household weights. I have been manually copying and pasting the tables in excel and have not be successful in exporting them using the put excel command. I tried looking up the command online but none of the responses seem to serve my purpose. To be clear, I run the following command:
by year: tab age_new race_new [iw=hwtsupp] if pernum==1 & gq==1
which generates the total number of households by age , race and by year. I have data for years from 1994-2017 and need to export them to excel. I can do a manual copy and paste but my manager wants me to automate the whole thing so that there is no chance of an error creeping in.
The results of the command above are as below (Please excuse me as I cannot install dataex on the stata here as I have it on my office laptop which has high security, therefore pasting the results here).:
by year: tab age_new race_new [iw=hwtsupp] if pernum==1 & gq==1
-> year = 1994
I have similar results for all years. I want to automatically export them to excel. Can someone help me please?
Thanks a ton in advance.
Best
Rama
I run a "by year: tab command" to get the number of households from the IPMUS CPS dataset using the household weights. I have been manually copying and pasting the tables in excel and have not be successful in exporting them using the put excel command. I tried looking up the command online but none of the responses seem to serve my purpose. To be clear, I run the following command:
by year: tab age_new race_new [iw=hwtsupp] if pernum==1 & gq==1
which generates the total number of households by age , race and by year. I have data for years from 1994-2017 and need to export them to excel. I can do a manual copy and paste but my manager wants me to automate the whole thing so that there is no chance of an error creeping in.
The results of the command above are as below (Please excuse me as I cannot install dataex on the stata here as I have it on my office laptop which has high security, therefore pasting the results here).:
by year: tab age_new race_new [iw=hwtsupp] if pernum==1 & gq==1
-> year = 1994
race_new | |||||
age_new | H | NHB | NHO | NHW | Total |
20 | 53,218 | 86,063 | 23,129 | 376,499 | 538,910 |
75 | 366,961 | 678,916 | 110,745 | 8,010,804 | 9,167,426 |
2024 | 616,148 | 651,337 | 185,311 | 3,273,077 | 4,725,873 |
2529 | 1,045,268 | 1,173,399 | 311,658 | 5,942,035 | 8,472,359 |
3034 | 1,280,701 | 1,513,661 | 426,486 | 8,024,158 | 11,245,005 |
3539 | 1,071,539 | 1,465,635 | 455,131 | 8,803,026 | 11,795,331 |
4044 | 979,417 | 1,292,771 | 376,040 | 7,849,920 | 10,498,147 |
4549 | 789,793 | 1,034,206 | 302,652 | 7,094,251 | 9,220,902 |
5054 | 584,439 | 775,019 | 265,277 | 5,990,874 | 7,615,609 |
5559 | 459,107 | 668,473 | 155,091 | 4,951,795 | 6,234,466 |
6064 | 410,656 | 614,688 | 106,759 | 4,821,587 | 5,953,690 |
6569 | 339,182 | 567,250 | 107,665 | 5,014,310 | 6,028,408 |
7074 | 286,588 | 487,201 | 91,233 | 4,745,538 | 5,610,561 |
Total | 8,283,016 | 11,008,619 | 2,917,177 | 74,897,874 | 97,106,687 |
I have similar results for all years. I want to automatically export them to excel. Can someone help me please?
Thanks a ton in advance.
Best
Rama
Comment