Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Conditional DO Loops Using the data in pg2.eu_sports, write a DATA step to create a table named MoreExports by doing the following: Subset the

image text in transcribed
image text in transcribed
1. Conditional DO Loops Using the data in pg2.eu_sports, write a DATA step to create a table named MoreExports by doing the following: Subset the input data to only look at rows where Year is 2015, Country is "Malta", and Sport_Product is "FISHING" or "GOLF". In a DO loop, increase Year from 2017 in 2-year jumps until either (1) Year is 2031 or (2) Amt_Export exceeds % of Amt_Import, whichever comes first. In each iteration of the loop, increase Amt_Export by 30%. Output during each iteration of the loop. Write a PROC PRINT step to display MoreExports. Show all your code and the output of the PROC PRINT. 2. Using a Character Variable as an Index and Terminating a DO Loop Early Using the data in pg2.np_summary, we wish to estimate each park's visitors over (up to) the next three years. Create a table named VisitProj in a DATA step by doing the following: Create an index variable in a DO loop named Projected, which iterates through the values "ist Year", "2nd Year", and "3rd Year". (see a helpful blog here, especially the first example discussing "foreach loops": https://blogs.sas.com/content/iml/2011/09/07/loops-in-sas.html ). In each iteration of the DO loop, increase Day Visits by 5%. Use an IF condition to terminate the DO loop early if DayVisits exceeds 17000. You can exit the loop using the LEAVE statement (see a helpful blog here: https://blogs.sas.com/content/iml/2017/03/15/leave-continue- sas.html). Do not include any explicit output statements. Drop all columns except ParkName, Projected, and Day Visits. Write a PROC PRINT step to display the first 5 rows of VisitProj. Show all your code and the output of the PROC PRINT. 3. Using a DATA step to Convert a Wide Table to a Narrow Table The table pg2. mp_2017camping is currently stored as a wide table. Write a DATA step to convert it to a narrow table named CampNarrow. CampNarrow should only contain three columns: ParkName (which has the same values as the input table) CampType (which has the values "Tent", "RV", or "Backcountry": ensure that the entire value is stored) . CampCount (which has the numerical counts from the input table) Write a PROC PRINT step to display the first 9 rows of CampNarrow. Show all your code and the output of the PROC PRINT

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Geometry And Analysis Of Fractals Hong Kong, December 2012

Authors: De Jun Feng, Ka Sing Lau

1st Edition

3662439204, 9783662439203

More Books

Students also viewed these Mathematics questions

Question

L * L ^ ( - 1 ) * L

Answered: 1 week ago

Question

2. It is the results achieved that are important.

Answered: 1 week ago