SPSS Statistics

 View Only
  • 1.  New variables

    Posted Thu December 02, 2021 01:55 AM
    Hello everyone!

    just needed to merge variables to one.
    The cases are the following:
    I have Two categorical variables  "trauma exposure during pandemic (0=no, 1=yes)" and "trauma exposure before pandemic (0=no, 1= yes)"
    I wish to
    α) transform them to ONE categorical variable called: Νο Trauma Exposure (=0) and Trauma Exposure (=1) and,
    b) to make a new categorical variable (with 2 categories), which will include only the Trauma Exposure during the pandemic and the Trauma exposure before the pandemic, and
    c) in combination with the variable  PTSD at risk (=1) and PTSD not at risk (=0) to make a new variable which will include the following three categories:
    1. Νο Trauma Exposure
    2. Trauma Exposure at risk for PTSD
    3. Trauma Exposure not at risk for PTSD. 

    Could anyone help me with this?

    Many thanks in advance!



    ------------------------------
    Sandy
    ------------------------------


  • 2.  RE: New variables

    Posted Thu December 02, 2021 07:41 AM
    See if this what you want.

    *The cases are the following:
    I have Two categorical variables "trauma exposure during pandemic (0=no, 1=yes)" and "trauma exposure before pandemic
     (0=no, 1= yes)". I wish to
    * transform them to ONE categorical variable called: Νο Trauma Exposure (=0) and Trauma Exposure (=1) and,
    * to make a new categorical variable (with 2 categories), which will include only the Trauma Exposure during
      the pandemic and the Trauma exposure before the pandemic, and
    * in combination with the variable PTSD at risk (=1) and PTSD not at risk (=0) to make a new variable which
      will include the following three categories:
    1. Νο Trauma Exposure
    2. Trauma Exposure at risk for PTSD
    3. Trauma Exposure not at risk for PTSD.

    *Test data.
    data list free /exposed_during (F1) exposed_before (F1) ptsd (F1).
    begin data.
    0 0 0
    0 1 0
    1 0 0
    1 1 0
    0 0 1
    0 1 1
    1 0 1
    1 1 1
    end data.

    *Compute variables.
    compute trauma_exposure=exposed_during or exposed_before.
    compute exposed_both=exposed_during and exposed_before.
    do if trauma_exposure=0.
    compute three_level=1.
    else.
    if ptsd three_level=2.
    if not(ptsd) three_level=3.
    end if.

    *Check values.
    list.