Using the data set CHAR1 from problem 18.1,create a new variable (NEW3) [rom the variable STRING3 based on the following rules: First, remove embedded blanks and the characters '>', 'I', '.",and' ,'....


Using the data set CHAR1 from problem 18.1,create a new variable (NEW3) [rom the variable STRING3 based on the following rules: First, remove embedded blanks and the characters '>', 'I', '.",and' ,'. Next, substitute the letters A-H for the numerals 1-8. Finally, set NEW3 equal to a missing value if there are any characters other than A-H (trailing blanks are OK) in the string. The value of NEW3 for the three observations should be: 'ABCDEFGH', missing, and 'ABC'.


Problem 18.1


First, create a data set called CHAR1 by running the following DATA step:


Create a new data set ERROR containing any observations in CHARI that meet anyone of the following conditions:


1. A value other than an 'X', 'Y', or 'Z' for the variable STRING1.


2. A value other than an 'A', 'B', 'C', '0', or 'E' in STRING2.


3. A value other than an upper- or lowercase 'N' or 'Y' for the variables C1-C5. (NOTE: Blank values of CI-C5 will place the observation in the ERROR data set.)



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here