Question
Level 1 1. Using the %UPCASE and %SCAN Functions a. Open m103p01.sas from the practices folder. Add a %LET statement to convert the value of
Level 1 1. Using the %UPCASE and %SCAN Functions a. Open m103p01.sas from the practices folder. Add a %LET statement to convert the value of FullName to uppercase and assign the result to FullName. Write a single %PUT statement to display FullName in a sentence using both its current form and proper case, as shown below. Submit the program and view the log to verify the results. Note: Use %SYSFUNC to execute the PROPCASE function. ANTHONY MILLER in proper case is Anthony Miller. b. Modify and submit the program. Add a %LET statement to extract the first name from FullName, convert it to proper case, and assign the result to a macro variable named First. Add another %LET statement to extract the last name from FullName, convert it to proper case, and assign the result to a macro variable named Last. Display the values of FullName, First, and Last in the log as shown below. FULLNAME=ANTHONY MILLER FIRST=Anthony LAST=Miller c. Add a %SYMDEL statement to delete FullName, First, and Last from the global symbol table. Use a %PUT statement to write the values of all user-defined macro variables to the log. Submit the two statements and verify that that FullName, First, and Last are no longer listed. Level 2 2. Using Macro Quoting Functions a. Open m103p02.sas from the practices folder and review the code. Submit the program and review the results. Note that the footnote includes the date and time that the SAS session started. b. Create a macro variable named Product and assign the value R&D. Reference Product in the TITLE and WHERE statements, replacing Jacket. Modify the FOOTNOTE statement to display the current date and time, using the DATE9 and TIMEAMPM9 formats respectively. Submit the program and verify that the title is Product Names Containing 'R&D' and that the current date and time are displayed in the footnote. How many rows are in the report? 6. Creating Macro Variables with the SYMPUTX Routine a. Open m103p06.sas from the practices folder. Review and submit the program. Verify that the report title is New Staff: Administration Department and that the sum of Salary is $221,618. b. Add a %LET statement to assign the value Administration to a new macro variable named dept, and replace every occurrence of Administration with a reference to dept. Submit the modified program and verify that the title and report are the same as in part a. C. Change the value of dept to Sales and submit the program. Verify that the report title is New Staff: Sales Department What is the sum of Salary? d. Modify the DATA step to create a macro variable named avg to store the average salary on the last iteration. Hint: Use the PUT function and the DOLLAR9. format when assigning the value to avg. Add a FOOTNOTE statement before the PROC PRINT step to display the value of avg as shown below. Submit the program and review the results. Average Salary: $xx,xxx What text is displayed in the footnote? 8. Using Indirect References to Macro Variables a. Open m103p08.sas from the practices folder. Submit the code and review the results. High Profit Products for Type 1 Orders Row Product ID Gross Sales Profit 1 240200200081 5852.40 $820.35 2 210201000101 $5.20 $5.00 b. Explore the mc1.order_type_codes table. The Order_Type_Code column contains the values 1, 2, and 3, and the Order_Type column identifies the type of order associated with the code. Close the table. c. At the top of the program, insert an SQL query to access mc1.order_type_codes and create a series of macro variables named Type1, Type2, and Type3. Assign the value of the Order_Type variable associated with each order type. Suppress the PROC SQL output, and add a %PUT statement to write the values of Type1, Type2, and Type3 to the log. d. Submit the PROC SQL step and the %PUT statement. Review the log. Verify that the log contains TYPE1=Retail Store TYPE2=Catalog TYPE3=Internet. e. Modify the TITLE statement to use an indirect macro variable reference to the Type variable that corresponds to the value of code. Submit the entire program and review the results. Verify that the report contains the same two rows generated by the original report and that the title is High Profit Products for Retail Store Orders. f. Modify the %LET statement to assign a value of 3 to the macro variable, code. Resubmit the program and review the results. What is the report title?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started