Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

. The ParkCode column should include only the first four characters in the string. Add a LENGTH statement in the proper place in the DATA

image text in transcribed
. The ParkCode column should include only the first four characters in the string. Add a LENGTH statement in the proper place in the DATA step to define the length of ParkCode as 4. . The length for the ParkName column can be optimized by determining the longest string and setting an appropriate length. Modify the DATA step to create a new column named NameLength that uses the LENGTH function to return the position of the last non-blank character for each value of ParkName. . Use a RETAIN statement to create a new numeric column named MaxLength that has an initial value of 0. Use an assignment statement and the MAX function to set the value of MaxLength to either the current value of NameLength or MaxLength, whichever is larger. . Use the END= option in the SET statement (see https://v8doc.sas.com/sashtml/lgref/z0173782.htm, especially Example 11) to create a temporary variable in the PDV named LastRow. LastRow will be 0 for all rows until the last row of the table, when it will be 1. Add an IF-THEN statement to write the value of MaxLength to the log if the value of LastRow is 1. data parklookup; set pg2.mp_unstructured_codes; ParkCode=scan(Column1, 2. '0:"0- ParkName=scan(Column], 4. '0:"0' run : proc print data =parklookup( obs =10 ); run ; proc contents data =parklookup; run : Show your final DATA step code, and include a screenshot of the log that shows the resulting value of MaxLength

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

Introductory Algebra Concepts And Graphs

Authors: Charles P McKeague

1st Edition

1630980110, 9781630980115

More Books

Students also viewed these Mathematics questions

Question

3. Im trying to point out what we need to do to make this happen

Answered: 1 week ago

Question

1. I try to create an image of the message

Answered: 1 week ago