I can see how it would be a good exercise for a new sas learner. It would help them figure out iterative processing, SAS functions, and the order of operations as well as teaching them how to deal with the situation of 1 square root being calculated vs having a file of numbers for which sq rts needed to be calculated.
My general policy on posting code is that if I have a sample program that can be easily changed to illustrate a point, I will post the code. I read the algorithm and I have a general idea of how to write the program.
But there's no benefit for me to write the program. Part of the learning process, in general is understanding the problem and solving it in concept. Then once you understand the solution in concept, if you have to go a step further and write code, then the best way to LEARN is to try something, try something else, make some progress, make some mistakes, read some documentation, try something and read some more documentation (gee, I need a way to break this number into "chunks" -- let me look at the list of SAS functions), and try something else.
At any rate, this question really is off topic for SAS and clinical trial questions and doesn't really belong in this forum.
cynthia