08-05-2014 12:42 AM
/*do while (A >0);*/
do i=1 to length(a);
When I run this code instead of 4 My loop is runs for 12 times Can any one explain me .
08-05-2014 01:28 AM
The reason is you are applying a character function - LENGTH - to a number - 12345. So SAS is automatically converting the number into a character variable using the BEST12. SAS format.
Inside SAS your number now looks like this (ignore the surrounding quotes) - ' 12345' - in other words it has 7 blank spaces in front of the number.
So that is why your look runs 12 times. If you changed a=12345 to a='12345' it would loop 5 times.
Need further help from the community? Please ask a new question.