Hi @rajeshalwayswel,
It appears that you want to apply a conditional format, i.e., one that depends on certain rules. So, maybe the PUTN function can be applied. But, as the others have pointed out, you need to know those "certain rules."
Here are two examples using rather arbitrary rules both of which produce the desired values (in a character variable W in dataset WANT) for your sample data using the w.d format with a varying value of d and left-justified by the -l modifier.
Values of d are pre-specified in an array:
data want;
array d[7] _temporary_ (0,1,2,4,0,3,1);
set a;
length w $10;
w=putn(input(l,10.),cats('10.',d[_n_],'-l'));
run;
[Fun solution:] Values of d follow a random pattern (Poisson distribution with parameter 2):
data want;
set a;
length w $10;
w=putn(input(l,10.),cats('10.',ranpoi(1382551861,2),'-l'));
run;
If you need the formatted value just for output (e.g. to a text file), the $VARYINGw. format might be useful.
Example (similar to no. 1 above, but now the lengths are pre-specified and the results are written to the log😞
data _null_;
array len[7] _temporary_ (3,3,4,6,1,6,5);
set a;
w=put(input(l,10.),10.4-l);
varlen=len[_n_];
put w $varying10. varlen;
run;
... View more