Is there a way to transform data in Stata from a single observation (e.g. # of patients experiencing an event) into many observations?
I'm trying to efficiently use Stata to estimate standard errors around a proportion of patients experiencing an adverse event in a model we are adapting. An example dataset:
n = 74
a = 56
b = 18
Where n is the number of patients, a is the number of patients experiencing an event and b is the number not experiencing an event.
When the data is in this format, I note that using
ratio myratio: a/n
Returns a proportion (a/n) but does not estimate a linearized standard error. Manually converting the data into "long" format however fixes this issue. Long format being:
No. observations = n (74)
n = 1 for all observations
a = 1 if index <= 18 else 0
b = 1 if index > 18 else 0
It's been a while since I have used Stata, is there a quick way to do this? I can't even remember how to extend the length of the dataset to the number of samples N!
from Recent Questions - Stack Overflow https://ift.tt/2J8YRGA
https://ift.tt/eA8V8J
Comments
Post a Comment