data hadoopdata;
price =100000;
do until(price gt 500000);
year+1;
price+(price*.10);
end;
run;
How to interprate DO WHILE statement that will generates the same results?
Technically, the DO UNTIL loop executes at least once even if the original value of PRICE is 600000 instead of 100000. To get a DO WHILE loop to produce the same outcome, you need to allow for that fact. So:
data hadoopdata;
price=100000;
year+1;
price = price * 1.1;
do while (price le 500000);
year + 1;
price = price * 1.1;
end;
run;
If you want to translate this to a do-while loop, then you could try:
data hadoopdata;
price =100000;
do while(price le 500000);
year+1;
price+(price*.10);
end;
run;
Regards,
Amir.
@swayto wrote:
data hadoopdata;
price =100000;
do until(price gt 500000);
year+1;
price+(price*.10);
end;
run;
How to interprate DO WHILE statement that will generates the same results?
Would you please be kind enough to explain your question in more detail? It's not really clear what you are asking.
Technically, the DO UNTIL loop executes at least once even if the original value of PRICE is 600000 instead of 100000. To get a DO WHILE loop to produce the same outcome, you need to allow for that fact. So:
data hadoopdata;
price=100000;
year+1;
price = price * 1.1;
do while (price le 500000);
year + 1;
price = price * 1.1;
end;
run;
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.