Write and run SAS programs in your web browser

DO UNTIL STATEMENT

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

DO UNTIL STATEMENT

Please explain how the do until loop as shown in the picture iterates to give the output as show in the other picture.

y.pngx.png


Accepted Solutions
Solution
3 weeks ago
Super User
Super User
Posts: 6,502

Re: DO UNTIL STATEMENT

DO UNTIL means that the loop iterates until the condtion IS true.

On the first iteration X=5 so that is less than 50 so the loop continues. On the second iteration X=10 which is also less than 50, etc.

View solution in original post


All Replies
Trusted Advisor
Posts: 1,404

Re: DO UNTIL STATEMENT

The code X+5; (whithout the equal = sign) means: start with 0 and add 5 at each iteration.

 

do until (x>50); means to stop loop at the given condition.

New Contributor
Posts: 2

Re: DO UNTIL STATEMENT

but at x=5 or any value less than 50 the statements within the do group shouldn't get executed but it is getting executed and that is my doubt.
Solution
3 weeks ago
Super User
Super User
Posts: 6,502

Re: DO UNTIL STATEMENT

DO UNTIL means that the loop iterates until the condtion IS true.

On the first iteration X=5 so that is less than 50 so the loop continues. On the second iteration X=10 which is also less than 50, etc.

Super User
Super User
Posts: 6,502

Re: DO UNTIL STATEMENT

SAS code is just simple text. Paste in the text so that it is readable and can be copied.  Use the Insert SAS code icon to get a pop-up window where you can paste the code so that it retains its formatting.

 

Posting photogrpahs of text takes longer than pasting the actual text. So it is a waste of your time and of the readers time.

Super User
Posts: 17,949

Re: DO UNTIL STATEMENT

As someone else mentioned, please post input and output as text, not images. 

 


rohit_95 wrote:

Please explain how the do until loop as shown in the picture iterates to give the output as show in the other picture.

y.pngx.png


 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 335 views
  • 2 likes
  • 4 in conversation