How to recode variables in table 1 using info from table 2 (in SAS)

后端 未结 3 433
太阳男子
太阳男子 2021-01-26 12:18

The overal goal is to stratify quantitative variables based on their percentile. I would like to break it up into 10 levels (e.g. 10th, 20th, ...100th percentile)

3条回答
  •  有刺的猬
    2021-01-26 12:54

    A different option - PROC RANK. You could probably make it more 'automated' but it's pretty straightforward. Using PROC RANK you could also specify different ways of dealing with ties. Note that it would go from 0 to 9 rather than 1 to 10 but that's trivial to change.

    data test (drop=i);
    do i=1 to 1000;
    a=round(uniform(1)*4,.01);
    b=round(uniform(1)*10,.01);
    c=round(uniform(1)*7.5,.01);
    output;
    end;
    stop;
    run;
    
    proc rank data=test out=want groups=10;
    var a b c;
    ranks rankA rankB rankC;
    run;
    

提交回复
热议问题