Support #1889

Missing waves when merging UKHLS and BHPS datasets

Added by Neil Smith about 1 year ago. Updated 7 months ago.

Data documentation
Start date:
% Done:



Hi there,

I have merged the UKHLS and BHPS datasets for a few data variables which were used in both datasets and some which were used in only the UKHLS dataset. I have used the online stata code provided for merging these 2 datasets. Whilst this has worked fine, when I aim to add the j1none variable (which had only been used in the UKHLS dataset), an error occurs as there was no j1none variable for the first wave of the UKHLS (wave a). Whilst j1none had not been used in the bhps, it is important I can still add it as a variable to the merged dataset produced for my research (where the j1none data values for the bhps waves will be 'inapplicable').

Is there any code i can add/modify to the provided code for merging the bhps and ukhls dataset that will allow it to work when the first wave of a ukhls variable (or any wave) had not been recorded?

I look forward to your response.

Kind Regards,
Neil Smith


Updated by Understanding Society User Support Team about 1 year ago

  • Category set to Data documentation
  • Status changed from New to Feedback
  • % Done changed from 0 to 50
  • Private changed from Yes to No

Hello Neil,

Consider incorporating the "isvar" command in your code to identify defined variables when working with multiple datasets where you are not sure about their existence. Due to limited information available in the Stata help section, you may find helpful examples by searching for "isvar" on the statalist forum (

j1none is not included in the first wave (UKHLS) because is asked only for new entrants never been interviewed and have not been employed or self-employed and at wave 1 everyone is interviewed. On the other hand, you can find j1none on BHPS as bw_j1none_bh from waves 8 to 18.

Hope this helps
Best wishes
Roberto Cavazos
Understanding Society User Support Team


Updated by Understanding Society User Support Team 7 months ago

  • Status changed from Feedback to Resolved
  • % Done changed from 50 to 100

Also available in: Atom PDF