The SAS macro compiler was not invoked with your "open" SAS code statements. Wrap your code within a macro and the error occurs because of the imbedded semi-colon in the first %LET for macro variable LINE.
I have already read these documents ..when you replied back i was qick to copy open code in macro and it gave error - however i realized it was giving error because I forgot to put semi-colons in %str i.e.
Now it will not give error.
however I expect an error because %sysfunc(.. will unquote result whiich actually containts semi colon. if you replace
by %let line_length=%sysfunc(tranwrd(&line,%str(a),%str(k)));
it will give error because unquoting is occuring.
So I am not clear what does %length do so that there is no error?
Suggest you add the line below to generate more diagnostics during compilation. The problem is that your semi-colon characters have meaning while the macro compiler is resolving &line but prior to the outer functions.