首页 文章

在SAS中选择观察然后做

提问于
浏览
-1

如果这个列='Johanna',我想做的话,那么列薪水中的值应该在SAS中除以100 .

SAS中最好的方法是什么?

谢谢

Mr.F

2 回答

  • 0

    SQL update 可以修改表中的值,而无需重建(重写)整个表 . DATA Step将重写输出数据集 .

    Proc SQL;
      * divide a persons salaray by a constant;
      update mytable
      set salary = salary / 100
      where name = 'Joanna'
      ;
    

    重复提交代码将每次划分工资,因此请注意这一点 .

    update mytable
      set salary = salary / (select salary from mytable where name = 'OtherValue')
      where name = 'Joanna'
      ;
    

    分母( where name = 'OtherValue' )的选择标准可以是返回单行的表的任何有效选择 .

    如果要将值除以下一行或上一行中的值,请创建一个新问题并提供一些上下文和样本数据 .

  • 0

    假设您正在使用数据步骤

    If columnName = 'Joanna' then salary = salary/100;
    

相关问题