Question
Please provide answers using SAS code. 1) Download and the run the code homework_problem1.sas (see code below). It creates a dataset with three observations and
Please provide answers using SAS code.
1) Download and the run the code homework_problem1.sas (see code below). It creates a dataset with three observations and three variables (line1, line2, and line3).
******
DATA address;
INPUT #1 @1 line1 $50.
#2 @1 line2 $50.
#3 @1 line3 $50.;
DATALINES;
Mr. Jason Simmons
123 Sesame Street
Madison, WI
Dr. Justin Case
78 River Road
Flemington, NJ
Ms. Marilyn Crow
777 Jewell Avenue
Pittsburgh, PA
;
RUN;
******
2) Create a new variable called name that contains the last and first name only. The names should be separated by a comma.
3) Create a new variable called street which contains the street name in upper case. Replace Road, Street, or Avenue with Rd., St., and Ave.
4) Create a new variable called city that contains only the city name.
5) Create a new variable called state that contains only the state abbreviation.
6) Run the SAS code called homework_problem2.sas (see code below).
******
DATA string;
input string $10.;
DATALINES;
123nj76543
892NY10203
876pA83745
;
RUN;
******
7) Create the following variables.
x: a numeric variable containing the first two digits of the string
y: a numeric variable containing the third digit of the string
state: a character variable containing the fourth and fifth characters as uppercase letters
n1: a numeric variable containing the sixth digit of the string
n2: a numeric variable containing the seventh digit of the string
n3: a numeric variable containing the eighth digit of the string
n4: a numeric variable containing the ninth digit of the string
n5: a numeric variable containing the tenth digit of the string
8) Print out the results.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started