Hello,
I am doing a secondary data analysis of pre and post-surveys for a falls prevention program. There are 427 pre and post surveys, and each pre- and post-survey notes the # of times fallen in the past three months. I am trying to create a % change variable for each observation based on the TimesFallen_pre and TimesFallen_post variables.
I tried creating the variable by using this code:
gen ReducFalls_percent = (TimesFallen_post - TimesFallen_pre)/TimesFallen_pre
However, I the result is 417 missing values. Many of the participants recorded 0 falls on the pre-survey and 0 falls on the post-survey, so I think my issue is that 0 is being treated as missing? Or the gen command won't divide by 0?
If someone could please help me figure out the correct code to create a % change variable for each observation, that would be awesome.
Thank you
Related Posts with Creating Percent Change Variable
Adding multiple labels to regsaveI am saving coefficients using regsave (from ssc) and I am able to use the 'addlabel' option to add …
Coding_column_rowDear statalist community, I am in need to do the following exercise for my research, can anyone plea…
Creating event time variableHi, I have a time series of stock returns with multiple event date indicators, such as the following…
the `tebounds’ command - bound the average treatment effectHi Statalists, I am reaching out with some questions regarding the `tebounds’ command. I am wonderi…
Turning variable labels into variable names with a suffixHi I have data where my years are recorded in letters from H to CC (representing 1948 to 2021). The …
Subscribe to:
Post Comments (Atom)
0 Response to Creating Percent Change Variable
Post a Comment