Question

Copy/paste this data on online orders into SAS. Write a program that will read it including...

  1. Copy/paste this data on online orders into SAS. Write a program that will
  • read it including date informats;
  • create a variable, called WaitTime, that is the number of days between Order and Delivery. Use an IF statement to give a value of 0 if the Delivery date is missing;
  • recode the categories of method of payment, changing C to Credit and P to Paypal;
  • print the data set using a different date format than the informat; and
  • do proc means for number of items ordered, amount, and the days until delivery computed above.

ID    Nitems   Method   Amount   Order Delivery

A44730 5 C 140 10SEP18 14SEP18

B41373 1 C 35 08OCT18 17OCT18

A20919 12 P 220 18OCT18 25OCT18

C00099 2 C 47 30OCT18 03NOV18

B21013 4 P 82 11JAN19

D82908 6 P 168 11JAN19 15JAN19

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Sol:

Requirement:

  1. Copy/paste this data on online orders into SAS. Write a program that will
  • read it including date informats;

Solution:

use infile with cards to read data.

lists the varibales in input statement

use dlm option and set dlm as space

use truncover to read missing value

SAS code:

data orders;

infile cards dlm=' ' truncover;

input ID $ Nitems Method $ Amount Order:date9. Delivery:date9.;

format Order:date9. Delivery:date9.;

cards;   

A44730 5 C 140 10SEP18 14SEP18

B41373 1 C 35 08OCT18 17OCT18

A20919 12 P 220 18OCT18 25OCT18

C00099 2 C 47 30OCT18 03NOV18

B21013 4 P 82 11JAN19

D82908 6 P 168 11JAN19 15JAN19

;

run;

Requirement2:

create a variable, called WaitTime, that is the number of days between Order and Delivery. Use an IF statement to give a value of 0 if the Delivery date is missing.

Recode the categories of method of payment, changing C to Credit and P to Paypal;

S0lution:

modifying the above program

use intck function in sas to get the difference in days.

and if function to set the waittime is 0 if delivery is missing

SAS Code:

data orders;

infile cards dlm=' ' truncover;

input ID $ Nitems Method $ Amount Order:date9. Delivery:date9.;

format Order:date9. Delivery:date9.;

WaitTime=intck('days',Order,Delivery);

if Delivery in ('') then WaitTime = 0;

else WaitTime = WaitTime;

IF (Method= 'C') THEN Method = 'CREDIT';

IF (Method= 'P') THEN Method = 'PAYPAL';

cards;   

A44730 5 C 140 10SEP18 14SEP18

B41373 1 C 35 08OCT18 17OCT18

A20919 12 P 220 18OCT18 25OCT18

C00099 2 C 47 30OCT18 03NOV18

B21013 4 P 82 11JAN19

D82908 6 P 168 11JAN19 15JAN19

;

run;

Requirement 3:

  • print the data set using a different date format than the informat; and

Solution:

use procedure print in sas to print the dataset

use format mmddyy10.

SAS program:

proc print data=orders;
format Order mmddyy10. Delivery mmddyy10.;
run;

Requirement4:

  • do proc means for number of items ordered, amount, and the days until delivery computed above.

Solution:

use procedure means and list the variables in var statement.

SAS Code:


PROC MEANS DATA=orders;
var Nitems WaitTime;
run;

ENTIRE SAS SCRIPT IS

data orders;

infile cards dlm=' ' truncover;

input ID $ Nitems Method $ Amount Order:date9. Delivery:date9.;

format Order:date9. Delivery:date9.;

WaitTime=intck('days',Order,Delivery);

if Delivery in ('') then WaitTime = 0;

else WaitTime = WaitTime;

IF (Method= 'C') THEN Method = 'CREDIT';

IF (Method= 'P') THEN Method = 'PAYPAL';

cards;   

A44730 5 C 140 10SEP18 14SEP18

B41373 1 C 35 08OCT18 17OCT18

A20919 12 P 220 18OCT18 25OCT18

C00099 2 C 47 30OCT18 03NOV18

B21013 4 P 82 11JAN19

D82908 6 P 168 11JAN19 15JAN19

;

run;

proc print data=orders;

format Order mmddyy10. Delivery mmddyy10.;

run;

PROC MEANS DATA=orders;

var Nitems WaitTime;

run;

Add a comment
Know the answer?
Add Answer to:
Copy/paste this data on online orders into SAS. Write a program that will read it including...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Use C++ For this week’s lab you will write a program to read a data file...

    Use C++ For this week’s lab you will write a program to read a data file containing numerical values, one per line. The program should compute average of the numbers and also find the smallest and the largest value in the file. You may assume that the data file will have EXACTLY 100 integer values in it. Process all the values out of the data file. Show the average, smallest, largest, and the name of the data file in the...

  • EM221 Insert Draw Page Layout Formulas Data Review View Home Paste June 1: Byte of Accounting, In...

    journalize thse transactions EM221 Insert Draw Page Layout Formulas Data Review View Home Paste June 1: Byte of Accounting, Ine. issued 2,590 shares of its common stock to Jeremy after $22,660 in cash nd omputer o apment with a fair market value of$34,320 were received. 01. June I: Byte of Accounting, Inc, issued 2,371 shares of its common stock after acquiring from Courtney $38,500 in cash, computer equipment with a fair market value of $12,760 and office equipment with a...

  • This project will allow you to write a program to get more practice with the stack...

    This project will allow you to write a program to get more practice with the stack and queue data structures, as well as more practice with object-oriented ideas that we explored in the previous projects. In this assignment you will be writing a simulation of an order-fulfillment system for a company like Amazon.com. These companies take orders for products and ship them to customers based on what they have in inventory. For this assignment you will be performing a scaled-back...

  • Need help with b,c and d. A30 fx III. A B с 78 79 TOTAL LIABILITIES...

    Need help with b,c and d. A30 fx III. A B с 78 79 TOTAL LIABILITIES 80 81 b) In the next 3 months the following accounting events happened to the company (the VAT is 25% in each 82 event wherever it is possible). Record the accounting events in the books! (24p) 83 84 85 86 1. The owners opened a bank account and paid 300.000 K HUF in as a startup capital to launch the business. 87 88 2....

  • 8. Which of the following accounts has a normal debit balance? a. Accounts Payable b. Sales...

    8. Which of the following accounts has a normal debit balance? a. Accounts Payable b. Sales Returns and Allowances c. Sales d. Interest Revenue 9. Using a perpetual inventory system, the entry to record the purchase of $30,000 of merchandise on account would include a a. debit to Sales b. debit to Merchandise Inventory c. credit to Merchandise Inventory d. credit to Sales 10. A retailer purchases merchandise with a catalog list price of $15,000. The retailer receives a 30%...

  • Heavy Equipment and Machinery Inc. Trial Balance At December 31, 2019

    What is the answer to these tables? here is all the information that had been given to me and my answers to the question that I think needs to be answered to complete the two tablesYou have been hired as a Financial Consultant by Heavy Equipment and Machinery Inc. (HEMI).  HEMI is a private corporation that has finished its first year of operations. HEMI's owners plan to list the business on the Toronto Stock Exchange  (TSE) in the next 5 years; accordingly,...

  • MUST SHOW ALL CELL FORMULAS Required: You need to prepare a comprehensive 12-month budget, including supporting...

    MUST SHOW ALL CELL FORMULAS Required: You need to prepare a comprehensive 12-month budget, including supporting schedules and a report for the period January 1, 2020 to December 31, 2020 for Hedron, Inc. INFORMATION FOR HEDRON, INC. Hedron, Inc. is a company that re-sells one product, a particularly comfortable lawn chair. An overseas contractor makes the product exclusively for Hedron, so Hedron has no manufacturing related costs. PRODUCT COSTS In Nov of 2019, each lawn chair costs Hedron $4 per...

  • Write down your analysis of this case on factors like the interests involved, context and power...

    Write down your analysis of this case on factors like the interests involved, context and power PACIFIC OIL COMPANY (A)* "Look, you asked for my advice, and I gave it to you," Frank Kelsey said. "If I were you, I wouldn't make any more concessions! I really don't think you ought to agree to their last demand! But you're the one who has to live with the contract, not me!" Static on the transatlantic telephone connection obscured Jean Fontaine's reply....

  • Write down your analysis of this case on factors like 1. the negotiation process, strategy and...

    Write down your analysis of this case on factors like 1. the negotiation process, strategy and tactics PACIFIC OIL COMPANY (A)* "Look, you asked for my advice, and I gave it to you," Frank Kelsey said. "If I were you, I wouldn't make any more concessions! I really don't think you ought to agree to their last demand! But you're the one who has to live with the contract, not me!" Static on the transatlantic telephone connection obscured Jean Fontaine's...

  • 14. Select the number of participants in the Beck & Watson study Group of answer choices...

    14. Select the number of participants in the Beck & Watson study Group of answer choices 8 13 22 35 15. Beck & Watson determined their final sample size via Group of answer choices coding saturation triangulation ethnography 16.Through their study, Beck & Watson determined Group of answer choices after a traumatic birth, subsequent births have no troubling effects after a traumatic birth, subsequent births brought fear, terror, anxiety, and dread Subsequent Childbirth After a Previous Traumatic Birth Beck, Cheryl...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT