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

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

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

  • 10. The Beck & Watson article is a Group of answer choices quantitative study qualitative study...

    10. The Beck & Watson article is a Group of answer choices quantitative study qualitative study 11. Beck & Watson examined participants' experiences and perceptions using what type of research design? Group of answer choices particpant obersvation phenomenology 12. Select the participants in the Beck & Watson study Group of answer choices Caucasian women with 2-4 children Caucasian pregnant women 13. In the Beck & Watson study, data was collected via a(n) Group of answer choices internet study focus group...

  • Please read the article and answer about questions. You and the Law Business and law are...

    Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...

  • Required: 1. What is the amount of Apple’s accounts receivable as of September 30, 2017? 2....

    Required: 1. What is the amount of Apple’s accounts receivable as of September 30, 2017? 2. Compute Apple’s accounts receivable turnover as of September 30, 2017. 3. How long does it take, on average, for the company to collect receivables for fiscal year ended September 30, 2017? 4. Apple’s most liquid assets include (a) cash and cash equivalents, (b) short-term marketable securities, (c) accounts receivable, and (d) inventory. Compute the percentage that these liquid assets (in total) make up of...

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
ADVERTISEMENT