Reputation: 317
Do I have a way to refer a value in the following way => value=23032017 and I want to refer to the digit in the forth place of this number, i.e 2
Upvotes: 0
Views: 59
Reputation: 51566
If it is a number then use some simple arithmetic.
data _null_;
value=23032017 ;
do position=1 to 9;
digit = mod(int(value/10**(position-1)),10);
put position= digit= ;
end;
run;
position=1 digit=7
position=2 digit=1
position=3 digit=0
position=4 digit=2
position=5 digit=3
position=6 digit=0
position=7 digit=3
position=8 digit=2
position=9 digit=0
Upvotes: 1