Multiple imputation before or after creating variables? This question seemed simple, but I cannot find the answer in books. 
I know that the assumptions of multiple imputation require that only the variables are imputed that will be used in the analysis. So far, so good.
However, what if you don't have yet the variables you will use in the analysis, but only the "source" variables you will derive them from? 
For instance, I have in the source dataset the two variables "History of myocardial infarction" (No/Yes) and "Age at myocardial infarction" (of course, only present for those individuals with "Yes" at "History of myocardial infarction"). In my analysis I will need to define a variable "Myocardial infarction at early age", that will be "Yes" for those with myocardial infarction AND age at myocardial infarction <55 years. So, I need both source variables to create mine. Now, what should I do: 


*

*Impute the two source variables separately (so I have no missing values at "History of myocardial infarction" and "age at myocardial infarction") and then, in all the multiply imputed datasets, create the variable "Myocardial infarction at early age"?

*OR: first create the variable "Myocardial infarction at early age" from the two source variables in the source dataset, and then multiply impute the several missing values this variable will invariably have? 

 A: This problem is closely related to the issue of what are called "passive" variables: for example, the square of an imputed variable if the analysis involves a quadratic term in the variable, or an interaction term between two imputed predictor variables. This leads to an argument for Option 3, which is to impute both the source and the derived variables separately, treating the derived variable as "Just Another Variable" (see section 6 of that very useful overview of multiple imputation).
Although a particular imputed case then can be internally inconsistent, this approach works better in some examples than predicting only the source variables and then (passively) getting the value of the derived variable. This web page, in its discussion of transformations, non-linearities, and interactions, similarly favors the "Just Another Variable" approach, despite its lack of internal logical consistency in some individual imputed cases. It would seem wise to try different imputation approaches and see if they substantially affect the conclusions of your analyses.
For your particular application, however, I would suggest that you do not use "Premature/early onset myocardial infarction" as a binary outcome variable, as it throws away most information about the age at MI. That particular variable would seem much better handled by some form of survival analysis, which incorporates both the MI event, the age at which it happened, and the lack of an event in individuals who have not had an MI by their age at last follow up. Yes, the biological basis of early-onset MI may be different than for later-onset, but a continuous-time survival model that can incorporate time-dependent influences of predictors might demonstrate that more usefully.
Finally, I'm not sure that I understand what you mean by "only the variables are imputed that will be used in the analysis." As I understand it, variables that may help impute missing predictor values should also be imputed if you are using chained equations as in mice, even if they are not used as outcome predictors in your model.
