Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Importing variables labels from Excel to STATA

    Hello everyone,

    I hope you're doing well.

    I’m working with a dataset in Stata and noticed that some variable labels are missing. Fortunately, I have all the correct variable names and their corresponding labels in an Excel file, where the variable names match exactly between the Excel sheet and my Stata dataset.

    Is there a way to efficiently import these labels from the Excel file into Stata, ensuring they align with the correct variables?

    Thank you in advance for your help!

    Best regards,
    Margherita

  • #2
    If the variable names and labels are in separate variables within the same dataset, you can write a loop to assign the labels. Otherwise, it is difficult to suggest an approach without a data example. It would help if you provided:
    1. A sample of the imported dataset with variable names and labels.
    2. The dataset with variable names that need to be labeled.

    Comment


    • #3
      Margherita:
      did you add the -firstrow- option to your code when importing your dataset from Xcel to Stata (see -help import_excel-)?
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment

      Working...
      X