Question: Write a DATA step to create a new table named clean_traffic based on pg2.np_monthlytraffic: Add a LENGTH statement to create a new two-character-long column named

 Write a DATA step to create a new table named clean_traffic

Write a DATA step to create a new table named clean_traffic based on pg2.np_monthlytraffic: Add a LENGTH statement to create a new two-character-long column named Type. Add an assignment statement that uses the SCAN function to extract the last word from the ParkName column and assign the resulting value to Type. Use the SUBSTR function to create a new column named Park that reads each ParkName value and excludes the Type code at the end of the string. Note: Use the FIND function to identify the position number of the Type string (with any trailing blanks removed from Type). That value can be used in calculating the third argument of the SUBSTR function to specify how many characters to read. Add an assignment statement to use the UPCASE and COMPRESS functions to change the case of Region and remove any blanks. Add an assignment statement to change the case of Location to proper case. Use the COMPBL function to remove any extra blanks between words. . Use the TRANWRD function to create a new column named Gate that reads Location (after performing the previous step) and converts the string "Traffic Count At" to a blank. Create a new column named GateCode that concatenates ParkCode and Gate together with a colon (?) between the strings. Write a PROC PRINT step to display the first 10 rows of clean_traffic where Month is equal to 7. Only display the columns Type, Park, Region, Location, and GateCode, in that order. Include a descriptive title on the report. Show all your code and a screenshot of the PROC PRINT output

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 Mathematics Questions!