I’m using Stata 14.0 and I have a longitudinal data set.
Individuals are marked by ID numbers (00-001-9), and each individual is one record. There is a ‘centre’ field to identify which centre was visited (apple/pear/peach) and then there are 5 date fields (screening date 1-5) and a binomial field associated with each screening date stating the vaccination status. The vaccine can only be received once. Once the vaccine is received, the vaccination status always stays 1, and the vaccination status is also reflected in an aggregated field rec_vac_2017 that is changed to 1 if vaccinated during any of the screening dates.
An example:
-----------------------
------------------
I would like to create a summary table in Stata that will reflect the total amount of individuals seen per day and their vaccination status, by centre. Something like this:
So I need to be able to see how many individuals were screened at each centre per day, although the same individual may be counted on different days.
Is there a code in Stata that will allow this?
And can this table be exported to excel?
Individuals are marked by ID numbers (00-001-9), and each individual is one record. There is a ‘centre’ field to identify which centre was visited (apple/pear/peach) and then there are 5 date fields (screening date 1-5) and a binomial field associated with each screening date stating the vaccination status. The vaccine can only be received once. Once the vaccine is received, the vaccination status always stays 1, and the vaccination status is also reflected in an aggregated field rec_vac_2017 that is changed to 1 if vaccinated during any of the screening dates.
An example:
-----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str6 id str5 centre str10 first_scrn_dt byte first_rec_vac str10 sec_scrn_dt byte sec_rec_vac str10 thi_scrn_dt byte thi_rec_vac str10 forth_scrn_dt byte forth_rec_vac str10 fifth_scrn_dt byte(fifth_rec_vac rec_vac_2017) "00-001" "apple" "03/03/2017" 0 "05/03/2017" 1 "" . "" . "" . 1 "00-002" "pear" "18/03/2017" 0 "20/03/2017" 0 "25/03/2017" 1 "" . "" . 1 "00-003" "apple" "05/03/2017" 0 "07/03/2017" 0 "" . "" . "" . 0 "00-004" "peach" "26/03/2017" 0 "" . "" . "" . "" . 0 "00-005" "peach" "03/03/2017" 0 "06/03/2017" 0 "09/03/2017" 1 "12/03/2017" 1 "25/03/2017" . 1 "00-006" "apple" "10/03/2017" 1 "" . "" . "" . "" . 1 "00-007" "pear" "11/03/2017" 1 "" . "" . "" . "" . 1 "00-008" "pear" "03/03/2017" 0 "05/03/2017" 1 "07/03/2017" 1 "20/03/2017" . "" . 1 "00-009" "pear" "12/03/2017" 0 "" . "" . "" . "" . 0 end
I would like to create a summary table in Stata that will reflect the total amount of individuals seen per day and their vaccination status, by centre. Something like this:
Apple | Pear | Peach | |||||||
Date | Vac | Not vac | Total | Vac | Not vac | Total | Vac | Not vac | Total |
3/3/2017 | 0 | 1 | 1 | 1 | 5 | 6 | 2 | 0 | 2 |
4/3/2017 | 0 | 1 | 1 | 2 | 6 | 8 | 2 | 2 | 4 |
5/3/2017 | 0 | 1 | 1 | 3 | 9 | 12 | 2 | 3 | 5 |
6/3/2017 | 1 | 2 | 3 | 10 | 10 | 20 | 2 | 5 | 7 |
7/3/2017 | 0 | 1 | 1 | 0 | 12 | 12 | 2 | 6 | 8 |
8/3/2017 | 0 | 1 | 1 | 2 | 30 | 32 | 2 | 8 | 10 |
9/3/2017 | 0 | 0 | 0 | 0 | 1 | 1 | 2 | 2 | 4 |
Is there a code in Stata that will allow this?
And can this table be exported to excel?
Comment