Transforming Variables

Key concepts/commands:

  1. destring: convert a string variable to a numeric variable

    destring iep blackhispanic ell thgrmathela, replace ignore("%" "#VALUE!")
  2. rename: rename a variable

    rename thgrmathela combined_score
  3. gen: create a new variable

    gen z_ell = (ell - 13.79202) / 12.33479
  4. log(): a function to create a log transformation (based on the natural log)

    gen log_ell = log(ell)
  5. order: rearrange the ordering of variables

    order log_ell, after(ell)
  6. drop: delete variables (or delete observations, as we will learn about later)

    drop z_ell
  7. egen: another way to create a new variable, relying on a specific set of functions for creating new variables

    egen z_ell = std(ell)