Solved
New Contributor
Posts: 2

# Need help on SAS code for calculating mileage and fuel.

[ Edited ]

hi,

A car deliver a ,mileageof 20 miles per gallon.write a progarm so that the program stops genrating observation when distance reaches

250 miles or when of fuel have been used.

use random example.

regards,

Accepted Solutions
Solution
‎02-21-2017 06:00 AM
Posts: 4,702

## Re: Need help on SAS code for calculating mileage and fuel.

[ Edited ]

How much pay do you offer for doing your homework?

Else: People here will be happy to help you if you get stuck solving this task BUT you need to demonstrate that you've done some work on your own first (i.e. posting some not yet working code and then ask questions related to your code).

All Replies
Solution
‎02-21-2017 06:00 AM
Posts: 4,702

## Re: Need help on SAS code for calculating mileage and fuel.

[ Edited ]

How much pay do you offer for doing your homework?

Else: People here will be happy to help you if you get stuck solving this task BUT you need to demonstrate that you've done some work on your own first (i.e. posting some not yet working code and then ask questions related to your code).

New Contributor
Posts: 2

thank for help.

Super User
Posts: 10,700

## Re: Need help on SAS code for calculating mileage and fuel.

```You owe me \$100 .

data _null_;
gallon=ceil(30*rand('uniform'));
do miles=20 to 250 by 20;
n+1;
if n gt gallon then leave;
put _all_;
end;
run;

```
☑ This topic is solved.