【问题标题】:SPSS equivalent to Excel IFS statementSPSS等同于Excel IFS语句
【发布时间】:2022-12-08 02:02:09
【问题描述】:

我想知道如何才能让如果一列中的值为 1,则此列中的值为 5,如果值为 0,则此列中的值为 10。

根据我所看到的,我只能拥有它,以便如果一列中的值为 1,则此列中的值为 5,如果该值为其他任何值,则此列中的单元格为空。

【问题讨论】:

    标签: function spss


    【解决方案1】:

    这会做到(是的,比ifs容易得多:)-

    recode thiscolumn (1=5)(0=10) into thatcolumn.
    

    现在这解决了你的例子,但recode 也可以解决更复杂的场景。这里我结合几个例子:

    recode thiscolumn (lo thr 0=-1)
                      (0 3=sysmis)
                      (1 2 4=1)
                      (5 thr 12=12)
                      (22 thr hi=22)
                      (miss=99)
                      (else=copy) 
            into thatcolumn.
    

    【讨论】:

      猜你喜欢
      • 2023-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多