Hi Madan,
I am not sure why you do want to write too many macro statements in this. in
your code, do while loop comparing character valuess and when it comes 7 th
observation &i value become character 2.1 and &max is character 19. Note
that binary value for character 2.1 is greater binary value for 19. thats
why loop stop iterating after 6th observation.
A simple solutions
%macro looping;
%let max=19;
%let min=0;
%let space=%sysevalf((&max.-&min.)/50);
%put &space;
data one;
i=(&min.);
k=(&max);
space=(&space);
do while (i < k);
i=i+space;
output;
end;;
run;
%mend;
%looping;
%**** this is just to show why you are getting 6 observation*/
data binary;
a='19';
b='2.1';
k=19;
l=2.1;
run;
data binary1;
set binary;
ninec=put(a, binary.);
twoc=put(b, binary.);
if (ninec + 0 )>(twoc + 0) then flagc='BIGNINE';
else flagc = 'BIGTWO';
ninen=put(k, binary.);
twon=put(l, binary.);
if (ninen +0) > (twon +0) then flagn ='BIGNINE';
else flagn='BIGTWO';
run;
Please let me know if any one has any comment.
Thanks and regards
Littish
mail: [log in to unmask]
----- Original Message -----
From: "Madan Kundu" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Tuesday, November 25, 2008 5:44 PM
Subject: Macro Problem
Dear All,
I am trying with the following macro, but unfortunately it is not providing
expeceted result. %do %while loop in the macro should repeat 50 times, but
it is only repeating for 6 times.
%macro looping;
%let max=19;
%let min=0;
%let space=%sysevalf((&max.-&min.)/50);
data one;
%let i=&min.;
%do %while (&i.<&max.);
max=&max.;
min=&min.;
i=&i.;
output;
%let i=%sysevalf(&i.+&space.);
%end;
run;
%mend;
%looping;
Please help to me to correct my macro.
Thanks & Regards,
Madan Gopal Kundu
--------------
Madan Gopal Kundu
Biostatistician, Ranbaxy Labs. Ltd.
Gurgaon, Haryana
India
Web: http://www.freewebs.com/madanstata
mobile: 91-9868788406
e-mail: [log in to unmask]
Connect with friends all over the world. Get Yahoo! India Messenger at
http://in.messenger.yahoo.com/?wm=n/
|