Question: DSCI 5 1 9 8 . Use a macro DO loop to repeat Part 2 of the program five times. The first time through the

DSCI 519
8. Use a macro DO loop to repeat Part 2 of the program five times. The first time through the loop, the program should generate the PDF report for the top supplier. The report should be modified as follows:
a. The prefix for each PDF file name should be the supplier rank number, 1 through 5. The name of each PDF file should be the value of Supplier_Name with all spaces replaced with underscores. Use the REPLACESPACE custom macro function.
1) After the ODS GRAPHICS statement, add a %DO macro statement with an index variable i that starts at 1 and ends at 5.
2) At the end of the program, before the %END statement (this closes the %IF %THEN/%DO block), add another %END statement.
3) After the %MACRO statement, add a %LOCAL statement to ensure that i is written to and read from the local symbol table.
4) In the ODS PDF statement, delete the hardcoded supplier name, 1_Eclipse_Inc (keep the .pdf extension) and replace it with an expression that does the following:
a) calls the %replacespace macro
b) includes the value of the macro variable i followed by an underscore as the file name prefix.
c) uses an indirect macro variable reference as the parameter for the %replacespace macro. The indirect reference should substitute the value of the Name1, Name2(and so on) macro variable.
b. The first title should be the rank of the supplier and then the Supplier_Name value, followed by the full country name for that particular supplier (for example, Orders for #1 Eclipse Inc, United States).
1) After the ODS statement, add a %LET statement to create a macro variable named CC that will be the two-letter CountryCode for the supplier being analyzed in the loop. (For example, when i=1, the value of CC is the CountryCode assigned to the Country1 macro variable.) This requires an indirect macro variable reference. This macro variable is used later to insert the country name in the title.
2) In the TITLE statement, use the i macro variable to substitute the rank number of the supplier.
3) Use an indirect macro variable reference to substitute the macro variable value for Name1, Name2, and so on.
4) Use an indirect macro variable reference to substitute the full country name. Remember that the macro variable Country_CC, where CC is the two-letter CountryCode for the supplier, stores the country name. Use the CC macro variable created earlier as part of the indirect reference.
c. The second title should be one of the following, depending on the value of the ot parameter: Retail Sales Only, Catalog Sales Only, or Internet Sales Only. To create the second title, use %IF,%THEN, and %END statements to provide unique TITLE2 statements depending on the value of the ot parameter.
d. For the bar chart (PROC SGPLOT step), the data should be subset to include one supplier at a time. Modify the WHERE statement to use an indirect macro variable reference to substitute the Supplier_ID value.
e. For the report (PROC SQL step), a footnote should be added below the report that includes the date and time that the report was created. The data should also be subset to include only the top supplier.
1) Add a FOOTNOTE statement before the last PROC SQL step.
2) Use %SYSFUNC to execute the TODAY() function and format it with an appropriate date format.
3) Use %SYSFUNC again to execute the TIME() function and format it with an appropriate time format.
9. Test the %SupplierReport macro program with parameter values of 1,2,3,4, and null. Make sure that when 4 is provided, the error message is written to the log and no output is generated. Test that error messages are also generated if a null value is provided.
10. Save the supplierreport.sas macro program in the Exam1 folder.
Answer the Following Business Questions:
Answer the following business questions using the reports created by the macro program.
1. Which company is the #2 supplier for internet sales only (Order_Type=3)?
2. What was the top product group for the top supplier for catalog sales only (Order_Type=2)?
3. Which country is the #4 supplier for retail sales only (Order_Type=1)?
4. Submit all your work in D2L.DSCI 519
Introduction
Orion Star company maintains detailed tables about the products that they offer, the orders placed by customers, and the suppliers for
each product. A SAS program has been written to prepare the data to summarize profit for each supplier. The first portion of the program
identifies the top suppliers. The second part of the program must be edited to generate a summary report for a particular supplier.
Information about the selected supplier, including the ID, name, and country, must be manually replaced in the program.
DSCI 5 1 9 8 . Use a macro DO loop to repeat Part

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!