통계 clinical trial/SAS

숫자->문자, 문자->숫자

고향이안드로메다 2018. 11. 1. 01:37

문자->숫자

1) xxx = input(zzz, 10.);

2) xxx = zzz *1


숫자 -> 문자

숫자변수를 문자변수로 바꾸는 코딩은 put함수를 사용합니다기본적인 포멧은 put(var, 자리수)


yyy = put (numeric, 15.);



data test;
length x $ 6;
input x;
y61=input(x,6.1);
best61=input(x,best6.1);
y60=input(x,6.0);
best60=input(x,best6.0);
cards;
.001
0.01
10
100
10.0
1E3
1.52E3
;

This produces the following data:

OBS     X          Y61    BEST61      Y60   BEST60
 1    .001       0.001     0.001     0.00     0.00
 2    0.01       0.010     0.010     0.01     0.01
 3    10         1.000     1.000    10.00    10.00
 4    100       10.000    10.000   100.00   100.00
 5    10.0      10.000    10.000    10.00    10.00
 6    1E3      100.000   100.000  1000.00  1000.00
 7    1.52E3  1520.000  1520.000  1520.00  1520.00