I have a dataset, N around 15,000, with some hearing tests from which I am using egen to generate a persistence of hearing deficit score.
There are 8 timepoint variables so my varlist - (tmpnt20 tmpnt21 tmpnt22 tmpnt23 tmpnt24 tmpnt25 tmpnt26 tmpnt27)
The data at these timepoints is - hearing deficit =1 none =0 but there is some missing data =.
I am trying to identify the proportion of time an individual had a hearing deficit across these timepoints.
I have egen a variable rowtotscore20_27 using
egen rowtotscore20_27 = rowtotal (tmpnt20 tmpnt21 tmpnt22 tmpnt23 tmpnt24 tmpnt25 tmpnt26 tmpnt27)
I have tried to now identify the missing data using rownonmiss.
egen rownonmissscore20_27 = rownonmiss (tmpnt20 tmpnt21 tmpnt22 tmpnt23 tmpnt24 tmpnt25 tmpnt26 tmpnt27)
What I now need to do is egen a proportion - So someone with 8 tests with zero score with get 0/8, someone with 4 tests and 2 hearing deficit scores would get 2/4 and someone with 5 tests and 5 hearing deficit scores would get 100%...how can I do this?
There are 8 timepoint variables so my varlist - (tmpnt20 tmpnt21 tmpnt22 tmpnt23 tmpnt24 tmpnt25 tmpnt26 tmpnt27)
The data at these timepoints is - hearing deficit =1 none =0 but there is some missing data =.
I am trying to identify the proportion of time an individual had a hearing deficit across these timepoints.
I have egen a variable rowtotscore20_27 using
egen rowtotscore20_27 = rowtotal (tmpnt20 tmpnt21 tmpnt22 tmpnt23 tmpnt24 tmpnt25 tmpnt26 tmpnt27)
I have tried to now identify the missing data using rownonmiss.
egen rownonmissscore20_27 = rownonmiss (tmpnt20 tmpnt21 tmpnt22 tmpnt23 tmpnt24 tmpnt25 tmpnt26 tmpnt27)
What I now need to do is egen a proportion - So someone with 8 tests with zero score with get 0/8, someone with 4 tests and 2 hearing deficit scores would get 2/4 and someone with 5 tests and 5 hearing deficit scores would get 100%...how can I do this?
Comment