DATA Step, Macro, Functions and more

Need help on SAS code for calculating mileage and fuel.

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Need help on SAS code for calculating mileage and fuel.

[ Edited ]

 hi,

Please proivde below code.

 

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
Respected Advisor
Posts: 4,173

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

[ Edited ]
Posted in reply to Dilawarsingh

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).

View solution in original post


All Replies
Solution
‎02-21-2017 06:00 AM
Respected Advisor
Posts: 4,173

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

[ Edited ]
Posted in reply to Dilawarsingh

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

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

thank for help.

Super User
Posts: 10,028

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

Posted in reply to Dilawarsingh
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.

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

Discussion stats
  • 3 replies
  • 336 views
  • 0 likes
  • 3 in conversation