Transposing wide to long in SAS, without extra columns

后端 未结 3 1467
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-25 07:48

I\'d like to transpose a dataset, but SAS insists on adding a new column, if the \"by\" column has multiple entries.

So if I run

data test;
    input a b         


        
3条回答
  •  余生分开走
    2021-01-25 08:20

    This ought to work (using your example code):

    proc transpose data=test out=test_tran1(rename=(_name_ = old_var));
      by a;
      var b c;
    run;
    
    proc transpose data=test_tran1 out=test_tran2(drop=_: rename = (col1=values) where = (not missing(values)));
      by a old_var;
      var col:;
    run;
    

提交回复
热议问题