k******w 发帖数: 269 | 1 How to keep the first digit of a number?
For example,
12
23
244
5678
99
100
I just want to first digit, what is the code? Thanks. | a***r 发帖数: 420 | 2 a "tu" method that works somehow
data example;
input firstdg 1.;
datalines;
12
23
244
...
;
run;
a "tu" method that works somehow
【在 k******w 的大作中提到】 : How to keep the first digit of a number? : For example, : 12 : 23 : 244 : 5678 : 99 : 100 : I just want to first digit, what is the code? Thanks.
| h***i 发帖数: 634 | 3 输入设成只接受一位数字
input a 1. ;
【在 k******w 的大作中提到】 : How to keep the first digit of a number? : For example, : 12 : 23 : 244 : 5678 : 99 : 100 : I just want to first digit, what is the code? Thanks.
| A****t 发帖数: 141 | 4 data one;
input id $;
datalines;
12
23
244
5678
99
100
;
run;
data two;
set one;
a=substr(id,1,1);
keep a;
run; |
|