Whats the problem about this loop?

Reply
New Contributor
Posts: 3

Whats the problem about this loop?

data _null_;

  n=3;

  do i=1 to 5;

       if i<n then

            do;    

                 continue;    

            end;

       else

            do;    

                 leave;    

            end;    

  end;

  put i=;

run;

The sas log:

9    quit;

10   data _null_;

11       n=3;

12       do i=1 to 5;

13           if i<n then

14               do;

15                   continue;

16               end;

17           els??? ????       do;

             --- -

             1   180

WARNING 1-322: Assuming the symbol ELSE was misspelled as els.

ERROR 180-322: Statement is not valid or it is used out of proper order.

Frequent Contributor
Posts: 95

Re: Whats the problem about this loop?

I am not seeing any errors when the above code was submitted.

If I replace 'else' with 'els' and submit I get the WARNING but not the ERROR.

What version of SAS and environment are you using?

New Contributor
Posts: 3

Re: Whats the problem about this loop?

Thank you for your help.

My SAS is version 9.2, and i used enhanced editor and submitted. But i always got ERROR , there were some question marks in the log. Very strange! I don't know why. I tried to install SAS again and the problem was still not resolved.

By the way, all other programs run correctly on the SAS.

New Contributor
Posts: 3

Re: Whats the problem about this loop?

I have solved this problem.

It is the SAS problem, perhaps a bug in my download SAS 9.2.

I installed SAS9.3, and then everything is OK.

Thank you anyway.

Ask a Question
Discussion stats
  • 3 replies
  • 326 views
  • 3 likes
  • 2 in conversation