ObjectiveThe information about the type of vaccine administrated may be missing in patients' health records. We aimed to apply a simple strategy, based on several factors, to impute, when missing, the type of administrated human papillomavirus (HPV) vaccines to study its association with thyroiditis.MethodsThe cohort study included Spanish health records (BIFAP) of girls. Follow‐up time was divided into non‐exposed, exposed, and post‐exposed. The vaccine type was obtained through a single stochastic imputation based on (non)clinical factors associated with both, missing and recorded values of 1st dose, confounders and outcome. HRs were estimated after imputation. As a secondary analysis, these were compared to other strategies: using only girls with vaccine type recorded (complete cases; CC) and all girls, including those without type recorded in a missing category (MiCat).ResultsA total of 808 201 observations for 388 411 girls were built. Vaccination type was carried out in 2.84% of 153 924 vaccinated girls remaining 35% for imputation. Fifteen factors associated and four confounders were identified for the imputation. HR departed by up to 10% overestimation for bi‐ and 10% underestimation for quadri‐ valent in the MiCat, whilst 24% and 3% respectively in the CC.ConclusionsIn our example, multiple factors associated with HPV vaccine type missing and values were identified suggesting missing not completely at random. Thus, CC and MiCat could bias the estimates. Those factors were used for imputation, doing more plausible the missing at random assumption. This strategy was simple, efficient and can be easily applied to analyses time‐varying exposure in pharmacoepidemiology.