Hi,
I have two variables: 1) age of initiating cigarette use with values from 10-23 and 2) age of initiating hookah use with values from 11-19. Also, these variables are not mutually exclusive and so people could have used both products at different ages. For example, a person could have first-tried a cigarette at 10 years and hookah at 13. I want to combine these variables so that I can create a new variable on age of initiating tobacco substances with values that reflect both variables. I therefore, do not want the variables to simply add up the values. I want the variable to show the lowest age of initiation for each age.
ex.
ageofciguse ageofhookahuse
16 15
15 16
10 17
12 22
11 11
14 19
15 16
19 18
16 14
Ideally, I would like to create a new variable
ageoftobaccouse
15
15
10
12
11
14
15
18
14
Next, how can I do this for more than two variables?
Related Posts with Merging two continuous variables in the same dataset
Panel type 2 Tobit with random effectsHi everyone, I'm was planning to estimate a correlated random effects model on panel data using st…
Manipulating macro listI have a do file which contains a macro list. I want to evaluate each element of the list and determ…
'No observations' errorDear all, I'm trying to conduct a unit root test to my variables using the following code: Code: …
Age standardizationI am calculating age-adjusted prevalence of certain diseases using direct method. I have a variable …
Regarding error message “ fpc for all observations within a stratum must be the same” with PPS sampling design, how to handle it ?Dear Statalists, I am running analysis on a survey dataset which use multi-stage stratified systemat…
Subscribe to:
Post Comments (Atom)
0 Response to Merging two continuous variables in the same dataset
Post a Comment