Home > Software design >  adding alphabet letters for values with a do loop in sas
adding alphabet letters for values with a do loop in sas

Time:04-22

data test;
length val $15;
input obs val $ pvalue;
cards;
1 demog 0.8812
2 ae 0.7112
3 dispostion 0.8234
4 exposure   0.7788
;
run;

I would like to get a new dataset with pvalue like 0.8812a, 0.7112b, 0.8234c, 0.7788d. The real datasets in my hand are pretty long and following with the alphabet letters such as e, f, g, etc. Could you please help me solve this problem with a do loop in sas?

Thank you so much!

CodePudding user response:

You should do something like this

data CLASS (drop = _h);
    set sasHelp.CLASS(rename =Height = _h);
    Heigth = cats(put(_h, 4.2), byte(rank('a')   _N_ - 1));
run;

but what exactly depends on your answers to Tom.

  • Related