Announcement

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

  • Code to import value labels

    Hey im trying to import value labels to a set of observations in a variable.
    Var name:
    Parentesco
    301
    601
    609
    301
    609
    I already have the "Parentesco" variable in stata, but have the value labels in csv, and i cant find a way to import the value labels into stata. Basically what i want is the observation "301" to have a label according to the csv file im attaching.

    Thanks in advance for the help you could provide!
    Attached Files

  • #2
    Hello Alberto. I opened your CSV file with a text editor, replaced the comma between fields with a space and a double quote ( "), then tacked " /// onto the end of every line. After a bit more clean-up, I generated this code, which I think should assign the value labels you want:

    Code:
    label define csvlabels ///
    101 "Jefe(a)"  ///
    102 "Persona sola"  ///
    201 "Esposo(a)"  ///
    202 "Concubino(a)"  ///
    203 "Amasio(a)"  ///
    204 "Querido(a) amante"  ///
    205 "Pareja del mismo sexo"  ///
    301 "Hijo(a)"  ///
    302 "Hijo(a) adoptivo(a)"  ///
    303 "Hijastro(a) entenado(a)"  ///
    304 "Hijo(a) de crianza"  ///
    305 "Hijo(a) recogido(a)"  ///
    401 "Trabajador(a) domÈstico(a)"  ///
    402 "Recamarero(a)"  ///
    403 "Cocinero(a)"  ///
    404 "Lavandera(o)"  ///
    405 "Nana niÒera nodriza"  ///
    406 "Mozo"  ///
    407 "Jardinero(a)"  ///
    408 "Velador vigilante"  ///
    409 "Portero(a)"  ///
    410 "Chofer"  ///
    411 "Ama de llaves"  ///
    412 "Mayordomo"  ///
    413 "Dama de compaÒÌa acompaÒante"  ///
    421 "Esposo(a) del(la) trabajador(a) domÈstico(a)"  ///
    431 "Hijo(a) del(la) trabajador(a) domÈstico(a)"  ///
    441 "Madre padre del(la) trabajador(a) domÈstico(a)"  ///
    451 "Nieto(a) del(la) trabajador(a) domÈstico(a)"  ///
    461 "Otro pariente del(la) trabajador(a) domÈstico(a)"  ///
    501 "No tiene parentesco"  ///
    502 "Tutor(a)"  ///
    503 "Tutelado(a) pupilo(a) alumno(a)"  ///
    601 "Madre padre"  ///
    602 "Padrastro madrastra"  ///
    603 "Hermano(a)"  ///
    604 "Medio(a) hermano(a)"  ///
    605 "Hermanastro(a)"  ///
    606 "Abuelo(a)"  ///
    607 "Bisabuelo(a)"  ///
    608 "Tatarabuelo(a)"  ///
    609 "Nieto(a)"  ///
    610 "Bisnieto(a)"  ///
    611 "Tataranieto(a)"  ///
    612 "TÌo(a)"  ///
    613 "Sobrino(a)"  ///
    614 "Primo(a)"  ///
    615 "Suegro(a)"  ///
    616 "Consuegro(a)"  ///
    617 "Nuera yerno"  ///
    618 "CuÒado(a)"  ///
    619 "ConcuÒo(a)"  ///
    620 "Padrino madrina"  ///
    621 "Ahijado(a)"  ///
    622 "Compadre comadre"  ///
    623 "Familiar otro parentesco"  ///
    701 "HuÈsped abonado(a) pensionista"  ///
    711 "Esposo(a) del(la) huÈsped"  ///
    712 "Hijo(a) del(la) huÈsped"  ///
    713 "Madre o padre del(la) huÈsped"  ///
    714 "Nieto(a) pariente del(la) huÈsped"  ///
    715 "Otro(a) pariente del(la) huÈsped"  ///
    999 "Parentesco no especificado"
    
    label values Parentesco csvlabels
    HTH.
    --
    Bruce Weaver
    Email: [email protected]
    Web: http://sites.google.com/a/lakeheadu.ca/bweaver/
    Version: Stata/MP 18.0 (Windows)

    Comment


    • #3
      Bruce i appreciate so much the help, it turned out perfectly. THANK YOU!

      Comment

      Working...
      X