Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit


SAS: Homework Assignment 1

 

In this assignment you will create a SAS program, save it as a .sas file, and upload that file to Moodle on the assignment link .

Notes:

•    The file submitted must meet the SAS File Submission          Guidelines available in the Resources and Information section of the course.

•     If your file doesn’t meet these guidelines, we may take up to 50% off from your score

•    You may work with a partner (from your section) for these     assignments.  However, the work that you submit must be yours in its entirety.  You must also reference the individual you  worked with in your assignment’s header.

•     No late work will be accepted.  If you have a documented emergency that prevents you from completing a homework   assignment, please contact your instructor.

•     Submission of the same (or extremely similar code) by two     people is considered an act of academic dishonesty.  Even if  you work with a partner, you must write your own final        comments and code.  We understand that the code itself may be very similar, but the comments, variable names chosen, etc.   should be different.


Datasets:

There are three datasets in your assignment link.  The datasets are in different raw data formats (sometimes you can tell from the file extension, for others you may need to open the file in a notepad    type program to check).  You must read in the versions of the files in your assignment link.

The datasets may or may not have the variable names included.  You may need to pull these from the information about the datasets     given at the end of this document.

You’ll need to upload these datasets to SAS On Demand in order to read them in.

 

Task 1: Conceptual questions (3 pts)         In comments after your header, answer the following questions:

1. What is the difference between a SAS step and a SAS statement?  (1 pt)

2. What is a library in SAS? (1 pt)

3. Which window do we check every time after we run our code? (1 pt)

 

Task 2: Programming questions (20 pts)

In the same file, write code corresponding to each question below.  That is, don’t simply overwrite/modify the code used for question 2 in question 3.  You can copy and paste the previous code if needed, but we need to see the code used to answer each question.  Don’t    forget to add comments prior to each SAS step describing what you   are doing!  We do not need the output.  We can recreate everything  using the code you turn in.

1. Create a permanent library using a LIBNAME statement. (1 pt)

2. Create code to import the three datasets in your assignment link into your permanent library created in question 1 . (3  pts each)

3. For any datasets that did not have variable names included, write a DATA step to overwrite the dataset in the permanent library with the variables renamed appropriately.  (4 pts)

4. For each dataset read in, create a PROC PRINT step that prints the data out. (2 pts each)

Save this program and upload it to moodle using the assignment link! Great work!


Dataset Information

Abalone

Purpose:

Predicting the age of abalone from physical measurements.  The age of abalone is determined by cutting the shell through the cone, staining it, and counting the number of rings through a icroscope -- a boring  and time-consuming task.  Other measurements, which are easier to     obtain, are used to predict the age.

 

Variables:

     Sex

     Length

     Diameter

nominal         continuous

continuous mm

     Height

     Whole weight

     Shucked weight

     Viscera weight

continuous continuous continuous continuous

•     Shell weight    continuous

•     Rings      integer

M, F, and I (infant)

mm   Longest shell measurement

perpendicular to length

mm   with meat in shell

grams whole abalone

grams weight of meat

grams gut weight (after bleeding) grams after being dried

+1.5 gives the age in years


Balance Scale

Purpose:

This data set was generated to model psychological experimental        results.  Each example is classified as having the balance scale tip   to the right, tip to the left, or be balanced.  The attributes are the left weight, the left distance, the right weight, and the right        distance.  The correct way to find the class is the greater of  (left- distance * left-weight) and (right-distance * right-weight).  If they  are equal, it is balanced.

Variables:

•     Class Name: 3 (L, B, R)

•     Left-Weight: 5 (1, 2, 3, 4, 5)

•     Left-Distance: 5 (1, 2, 3, 4, 5)

•     Right-Weight: 5 (1, 2, 3, 4, 5)

•     Right-Distance: 5 (1, 2, 3, 4, 5)

Bupa

Purpose:

The first 5 variables are all blood tests which are thought to be

sensitive to liver disorders that might arise from excessive       alcohol consumption.  Each line in the file constitutes the record of a single male individual.

 

Variables:

•     mcv

•     alkphos

•     sgpt

•     sgot

mean corpuscular volume

alkaline phosphotase

alamine aminotransferase

aspartate aminotransferase


•     gammagt

•     drinks    beverages

•     selector

Glass

gamma-glutamyl transpeptidase

number of half-pint equivalents of alcoholic

drunk per day

field used to split data into two sets



Purpose:

Classifying the type of glass. Motivated by criminological       investigation.  At the scene of the crime, the glass left can be used as evidence if it is correctly identified.

Variables:

•     Id number: 1 to 214

•     RI: refractive index

•     Na: Sodium (unit measurement: weight percent in corresponding oxide, as are attributes 4-10)

•     Mg: Magnesium

•    Al: Aluminum

•     Si: Silicon

•     K: Potassium

•     Ca: Calcium

•     Ba: Barium

•     Fe: Iron

•    Type of glass: (class attribute)

o 1 building_windows_float_processed

o 2 building_windows_non_float_processed

o 3 vehicle_windows_float_processed

o 4 vehicle_windows_non_float_processed (none in this database)

o 5 containers

o 6 tableware

o 7 headlamps

Hepatitis

Purpose:

Relating variables to hepatitis result.

Variables:

•     Class: DIE, LIVE

•    AGE: 10, 20, 30, 40, 50, 60, 70, 80

•     SEX: male, female

•     STEROID: no, yes

•    ANTIVIRALS: no, yes

•     FATIGUE: no, yes

•     MALAISE: no, yes

•    ANOREXIA: no, yes

•     LIVER BIG: no, yes

•     LIVER FIRM: no, yes

•     SPLEEN PALPABLE: no, yes

•     SPIDERS: no, yes

•    ASCITES: no, yes

•    VARICES: no, yes

•     BILIRUBIN: 0.39, 0.80, 1.20, 2.00, 3.00, 4.00

•    ALK PHOSPHATE: 33, 80, 120, 160, 200, 250

•     SGOT: 13, 100, 200, 300, 400, 500,

•    ALBUMIN: 2.1, 3.0, 3.8, 4.5, 5.0, 6.0

•     PROTIME: 10, 20, 30, 40, 50, 60, 70, 80, 90

•     HISTOLOGY: no, yes

Horse Colic

Purpose:

Relate measures associated with horse colic disease.

 

Variables:

•     Surgery?

-      1 =

-      2 =

•     Age

-      1 =

-      2 =

Yes, it had surgery

It was treated without surgery

 

Adult horse

Young (< 6 months)


•     Hospital Number

-      numeric id

-      the case number assigned to the horse (may not be unique if the horse is treated > 1 time)

•     rectal temperature (in degrees Celsius)

•     pulse (the heart rate in beats per minute)

•     respiratory rate

•     temperature of extremities

-      1 = Normal

-      2 = Warm

-      3 = Cool

-      4 = Cold

•     peripheral pulse

-      1 = normal

-      2 = increased

-      3 = reduced

-      4 = absent

•     mucous membranes

-      1 = normal pink

-      2 = bright pink

-      3 = pale pink

-      4 = pale cyanotic

-      5 = bright red / injected

-      6 = dark cyanotic

•     circulation

-      3 may occur in early shock

-      4 and 6 are indicative of serious circulatory compromise

-      5 is more indicative of a septicemia

•     capillary refill time

-      1 implies < 3 seconds

-      2 implies >= 3 seconds

•     pain

-

-

-

-

-

1 = alert, no pain

2 = depressed

3 = intermittent mild pain

4 = intermittent severe pain

5 = continuous severe pain


•     peristalsis

-      1 = hypermotile

-      2 = normal

-      3 = hypomotile

-      4 = absent

•     abdominal distension

-      1 = none

-      2 = slight

-      3 = moderate

-      4 = severe

•     nasogastric tube

-      1 = none

-      2 = slight

-      3 = significant

•     nasogastric reflux

-      1 = none

-      2 = > 1 liter

-      3 = < 1 liter

•     nasogastric reflux PH

•     rectal examination - feces

-      1 = normal

-      2 = increased

-      3 = decreased

-      4 = absent

•     abdomen

-      1 = normal

-      2 = other

-      3 = firm feces in the large intestine

-      4 = distended small intestine

-      5 = distended large intestine

•     packed cell volume (the # of red cells by volume in the blood)

•     total protein

•     abdominocentesis appearance

-      1 = clear


-      2 = cloudy

-      3 = serosanguinous

•     abdomcentesis total protein

•     outcome

-      1 = lived

-      2 = died

-      3 = was euthanized

•     surgical lesion?

-      1 = Yes

-      2 = No

•     Site of lesion

-      1 = gastric

-      2 = sm intestine

-      3 = lg colon

-      4 = lg colon and cecum

-      5 = cecum

-      6 = transverse colon

-      7 = retum/descending colon

-      8 = uterus

-      9 = bladder

-      11 = all intestinal sites

-      00 = none

•     Type of

-      1

-      2

-      3

-      4

•     Subtype

-      1

-      2

-      0

•     cp_data

-      1

-      2

Yeast

lesion

= simple

= strangulation

= inflammation

= other

of lesion

= mechanical

= paralytic

= n/a

= Yes

= No


Purpose:

Understanding proteins in yeast.

Variables:

•     Sequence Name: Accession number for the SWISS-PROT database

•     mcg: McGeoch's method for signal sequence recognition.

•     gvh: von Heijne's method for signal sequence recognition.

•     alm: Score of the ALOM membrane spanning region prediction program.

•     mit: Score of discriminant analysis of the amino acid content of

o the N-terminal region (20 residues long) of mitochondrial and

•     non-mitochondrial proteins.

•     erl: Presence of "HDEL" substring (thought to act as a signal for

o retention in the endoplasmic reticulum lumen). Binary attribute.

•     pox: Peroxisomal targeting signal in the C-terminus.

•     vac: Score of discriminant analysis of the amino acid content of

•     vacuolar and extracellular proteins.

•     nuc: Score of discriminant analysis of nuclear localization signals

o of nuclear and non-nuclear proteins.

•     Class Distribution. The class is the localization site

o CYT (cytosolic or cytoskeletal)

o NUC (nuclear)

o MIT (mitochondrial)

o ME3 (membrane protein, no N-terminal signal)

o ME2 (membrane protein, uncleaved signal)

o ME1 (membrane protein, cleaved signal)

o EXC (extracellular)

o VAC (vacuolar)

o POX (peroxisomal)

o ERL (endoplasmic reticulum lumen)

Zoo

Purpose:

A simple database containing 17 Boolean-valued attributes that can be related to types of animals.  The "type" attribute represents classes of animals outlined in the variable section.

Variables:

•     animal name:

•     hair

•     feathers

•     eggs

•     milk

•     airborne

•     aquatic

•     predator

•     toothed

•     backbone

•     breathes

•     venomous

•     fins

•     legs

•     tail

•     domestic


Unique for each instance

Boolean

Boolean

Boolean

Boolean

Boolean

Boolean

Boolean

Boolean

Boolean

Boolean

Boolean

Boolean

Numeric (set of values: {0,2,4,5,6,8}) Boolean

Boolean


•     catsize

•     type


Boolean

Numeric (integer values in range [1,7])


o 1 (41) aardvark, antelope, bear, boar, buffalo, calf, cavy, cheetah, deer, dolphin, elephant, fruitbat,


giraffe, girl, goat, gorilla, hamster, hare, leopard, lion, lynx, mink, mole, mongoose, opossum, oryx,      platypus, polecat, pony, porpoise, puma, pussycat,    raccoon, reindeer, seal, sealion, squirrel, vampire,  vole, wallaby, wolf

o 2 (20) chicken, crow, dove, duck, flamingo, gull, hawk, kiwi, lark, ostrich, parakeet, penguin, pheasant,

rhea, skimmer, skua, sparrow, swan, vulture, wren

o 3 (5)  pitviper, seasnake, slowworm, tortoise, tuatara

o 4 (13) bass, carp, catfish, chub, dogfish, haddock,    herring, pike, piranha, seahorse, sole, stingray, tuna

o 5 (4)  frog, frog, newt, toad

o 6 (8)  flea, gnat, honeybee, housefly, ladybird, moth, termite, wasp

o 7 (10) clam, crab, crayfish, lobster, octopus, scorpion, seawasp, slug, starfish, worm