AI and DS Skills

 View Only

Creating Categorical Variable with IF Command

  • 1.  Creating Categorical Variable with IF Command

    Posted 16 days ago

    Hello, I am a doctoral student and need help with SPSS syntax. I would like to create a categorical variable that includes all 4 disability types (deafness [DEAF], blindness [BLIND], learning disabilities [LRD], and physical disabilities[PHYS]). The binary disability variables are coded identically: 1=WITH DISABILITY, 0=NO DISABILITY. When I enter the following syntax however, I do not get the same n of students with disability in the newly created DIS variable as the n in each of the original variables. For instance, in the original DEAF variable, 238 students reported being deaf or hard of hearing. But in the new DIS variable, there are only 179 students. 

     Compute DIS=99. 

     
    if (deaf=1) DIS=1.
    execute.
     
    if (blind=1) DIS=2. 
    EXECUTE.
     
    IF (LRC=1) DIS=3. 
    EXECUTE.
     
    IF (PHYS=1) DIS=4. 
    EXECUTE. 
     
    RECODE 
        DIS
        (99=SYSMIS).
     
    VALUE LABELS DIS
        1 'Deaf'
        2 'Blind' 
        3 'LRD' 
        4 'PHYS'.
     
    Freq vars=dis deaf blind lrc phys/stat=min max mean stddev. 
    -----------------------------------------------------------END SYNTAX-----------------------------------------------------
    Can someone please tell me what I am doing wrong?
    Thanks in advance!



    ------------------------------
    Carrie Badillo
    ------------------------------