l**********8 发帖数: 305 | 1 作业不会写,请各位帮忙
2) Below are hypothetical data containing contact information for
sending a survey to patients. These data are made up and any resemblance to
real people with similar names or addresses is purely coincidental. Insert
the lines below into your SAS program. Do not make any alterations to the
data! Copy them exactly as shown below.
datalines;
Sonya Larson
10054 Plum Tree Rd
Buffalo NY 10068
716-555-1348
Peter Simpson
605 Glendover Dr
Isabel KS 67065
316-555-6566
Kip Holfser
902 West Blvd
Lansing, MI 48910
517-555-0227
Chan Rong
3052 East Bank Way
Lithonia GA 30058
912-555-0025
Mary Peters
10036 Lake View Dr
Greenbay, WI 54311
608-555-9031
Randy Nguyen
100 49th Street
Harrisburg, PA 19057
717-555-7773
;
Notes:
• Each observation is spread over four data lines.
• Look up and learn about the SAS functions Compress, StNameL, and
ZipCity.
问题是 a. Read these data into a SAS data set. Create the following
variables with the given attributes:
Variable Type (C or N) Length (# bytes) Notes
PatientName C 25
StreetAddress C 30
City C 25 Remove commas
State C 2
Zipcode C 5
Phone N 6 Remove dashes
b. Create a new variable, StateName, that contains the name of the state
with leading character capitalized and the remaining characters lower case.
c. Check the zip codes to see if they match the city names and states. If
they do not match, suggest either edits to the zip code or city/state. [You
may use comments in your program for this.] If the zipcode is invalid,
replace its value with “???”. [Note: Think big. There are only a few
observations here, but write your program as if there are thousands of
observations. You may use http://zip4.usps.com/zip4/welcome.jsp to confirm what your SAS program tells you and to make suggestions for edits. Be sure to include your method for recommending edits in your comments.] |
|