Prev: How to Implement Van Wijngaarden-Dekker-Brent Method in Base SAS
Next: Preserving leading blanks when importing Excel sheet
From: litonchen on 12 Aug 2010 03:25 How can I use %do ind=a %to z; in Macro? I have tried %do ind="a" ,"b" ,"c" ,"d" ,"e" ,"f" ,"g" ,"h" ..."z"; but still failed
From: RolandRB on 12 Aug 2010 05:03 On 12 Aug., 09:25, "litonc...(a)gmail.com" <litonc...(a)gmail.com> wrote: > How can I use %do ind=a %to z; in Macro? > I have tried %do ind="a" ,"b" ,"c" ,"d" ,"e" ,"f" ,"g" ,"h" ..."z"; > but still failed That is not valid in the macro language.
From: data _null_; on 12 Aug 2010 07:57
On Aug 12, 2:25 am, "litonc...(a)gmail.com" <litonc...(a)gmail.com> wrote: > How can I use %do ind=a %to z; in Macro? > I have tried %do ind="a" ,"b" ,"c" ,"d" ,"e" ,"f" ,"g" ,"h" ..."z"; > but still failed As mentioned the data step DO syntax is not supported by %DO. The may suffice. %macro a2z(arg1,arg2); %put NOTE: ARG1=&arg1 ARG2=&arg2; %do i = %sysfunc(rank(&arg1)) %to %sysfunc(rank(&arg2)); %let c = %sysfunc(byte(&i)); %put NOTE- i=&i c=&c; %end; %mend a2z; %a2z(a,z) %a2z(A,G) If you cross between upper case ascii "Z" and lower case ascii "a" you will get a few extra that are not alphabetic. As long as you use A-Z or a-z or some subset you will get the desired result. |