Announcement

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

  • use function on several variables

    Hello everyone,

    I want to apply a function to several variables but haven't found a solution.

    I have 14 variables : IRIS P19_LOG P19_RP P19_LOGVAC P19_MEN P19_MEN_ANEM0002 P19_PMEN P19_PMEN_ANEM0002 P19_RP_PROP P19_RP_LOC P19_RP_LOCHLMV C19_RP_HSTU1P C19_RP_HSTU1P_SUROCC
    IRIS is the id. I want to change the value of the 13 other variables by their rounded value, to the closest integer.

    replace var=round(var, 1)

    do i need to make 13 lines as such : replace P19_MEN=round(P19_MEN, 1),... or is there a shorter way ?

    Thanks a lot!!!

  • #2
    Duplicate post. Asked and answered at https://www.statalist.org/forums/for...eral-variables.

    Comment

    Working...
    X