SAS 11/01

Post on 07-Jul-2015

574 views 0 download

Tags:

Transcript of SAS 11/01

PROC STANDARDSAS FUNCTIONSSAS OPERATIONS

Canicia Smith

caniciasmith@gmail.com

Office hour: Wed 13:00-14:00

PROC STANDARD

What does proc standard do?1. It standardizes variables in a data set to a given mean and standard deviation.2. It creates a new data set containing the standardized values

http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a000146748.htm

Example

New data set

SAS FUNCTIONS

SAMPLE STATISTICS

Mean

=Mean(var1, var2)

Sum

=Sum(var1, var2)

Square root

=Sqrt(var)

Round

=round(var, .1)

SAMPLE STATISTICS (con.)

Maxmax(argument1, argument2)Minmin(argument1, argument2)Mod mod(argument1,argument-2)Eg. 9/3Argument1- the dividend=9Argument2-the divisor=3

LOG

• Log

X=log(var);

PROBABILITY

Ex. Poisson probability distribution

cdf (‘POISSON’, n, m)

N is an integer random variable (range: n=0,1, ..)

M is a numeric mean parameter (range: m>0)

EXPONENTIAL

• Exponential x=exp(1.0)=2.718

exp (argument)

SAS OPERATORS

SAS OPERATORS (ARITHMETIC)

Symbol Definition Example

**raise to a

powera**3

* multiplication 2*y

/ division var/5

+ addition num+3

- subtractionvar1-

var2

SAS OPERATORS (COMPARISON)

Symbo

l

Mnemonic

Equivalent Definition Example

= EQ equal to a=3

^= NE not equal to a ne 3

> GT greater than num>5

< LT less than num<5

>= GEgreater than or equal

tovar>=300

<= LE less than or equal to var<=300

IN IN equal to one of a list num in (3, 4,

5)

SAS OPERATORS (LOGICAL)

Symbol Mnemonic Equivalent Example

& AND (a>b) & (c>d)

/ OR (a>b) / (c>d)

^ NOT not (a>b)

QUESTIONS~?????

Possible Exam questions

Create a data set to give this output.

Which statement should be inserted to produce the group output?

Create a data set to get this output..

Proc meansWhat statement would produce the following output?

What statements do you need to produce the second output?

NamesSubject John Mary DickLucy James

Math 90 80 7874 70

English 96 60 78 50 74

French 87 87 56 78 95

Physics 45 65 34 77 73

History 77 66 88 56 89

5 students name John (boy), Mary (girl), Dick (boy), Lucy (girl), and James (boy) has the following scores in the following subjects:

1. Write a sas program to output this data.2. Find the mean and sum of each student’s grades.