Question: 4. Restructuring a Table Using the DATA Step: Wide to Narrow The pg2.np_2017 Camping table contains public use statistics for camping in 2017 from the

4. Restructuring a Table Using the DATA Step: Wide to Narrow The pg2.np_2017 Camping table contains public use statistics for camping in 2017 from the National Park Service. To enable statistics to be calculated for all camping locations, restructure the table as a narrow table. a. Open the p207p01.sas program in the practices folder. Highlight the PROC PRINT step and run the selected code. Note that the Tent, RV, and Backcountry columns contain visitor counts. Obs ParkName Tent RV Backcountry 1 Acadia NP 152 586 55,812 1,597 Amistad NRA 0 11,019 0 3 Aniakchak NM & PRES 0 0 235 Annella lelande AL b. To convert this wide table to a narrow table, the DATA step must create a new column named CampType with the values Tent, RV, and Backcountry, and another new column named Camp Count with the numeric counts. The DATA step includes statements to output a row for CampType='Tent'. Modify the DATA step to output additional rows for RV and Backcountry. c. Add a LENGTH statement to ensure that the values of the Camp Type column are not truncated. d. Run the DATA step. Confirm that each ParkName value has three rows corresponding to the Tent, RV, and Backcountry visitor counts
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
