You are on page 1of 120

SAS 9.

2
SAS is an integrated software to access, manage, analyze and present data. SAS system can be used to perform data entry, retrieval, management, report writing, graphics design, statistical and mathematical analysis, business forecasting and decision support, operational research, project management and application development. History of SAS: SAS began its company life in 197 and was called SAS institute. SAS Solutions or used at more then !",""" websites in 1#" counties.SAS is $oth a company and software. Why SAS? SAS is a boon to %ife science and commerce students. SAS is software where in they can use it in their domain and it is comparatively easy to learn as SAS& is neither a menu' driven nor a command driven application. (ather it relies on user'written scripts or )programs* that are processed when re+uested to ,now what to do. $ecause it is a script' based application, the ,ey to being successful using SAS is learning the rule and tric,s of writing scripts. -an process large data set.s/ 0asy to cope with multiple variables -an trac, all the operations on the data set.s/ -an generate systematic output Summary statistics 1raphs (egression results Features: 1. -ross platform support. 3. %ong term commitment to research and development. 1 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102 2. Support virtually any data format.

4. An integrated development environment. 5. 3igh level programming language. 6. -an process files containing millions of rows and thousand of columns of data.

SAS statement:
1. 0very SAS statement ends with a semicolon. 2. All SAS statements start with a ,ey word .data, input, proc/. 3. SAS statements can be entered in free format. 4. 6pper case and lower case are e+uivalent e7cept in side +uotation mar,s. 5. 8uotations can be single or double but, they must match. 6. A single statement can span in multiple lines. 7. Several statements can be on the same line.

SAS varia !es: 9here are # types of variables in SAS.


1. -haracter. #. :umeric.

"aria !e names:
1. SAS variable names begin with A ; < or a ; z or underscore. #. -annot contain blan,s or special symbols. 4. -an be 4# characters long in length. !. -an be uppercase, lowercase or mi7ed case.

Short#ut $eys:
1. (un ; =4 or => #. Submit ; =4 or => 4. -lear ; -trl ? 0 !. 6ndo ; -trl ? < # 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

5. 3elp ; =1 . (ecall ; =! 7. Show ,eys ; =9

4 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

Design of the SAS System


Multi-Engine Architecture DB2 Rdb dBase DATA EXCEL SYBASE

ORACLE

INFORMIX
SAS Training 6

DataBase Raw Data

SAS System Functionality


*ser +nterfa#es A##ess )ata %resent Ana!y(e &ana'e

Data Entry and Editing Retrieval Format

Report Graphics A,, )eve!o,ment -oo!s

Forecast

! 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! SAS Training 1

Page102

Statistics

DataBase Raw Data

SAS System Functionality


*ser +nterfa#es A##ess )ata %resent Ana!y(e &ana'e

Data Entry and Editing Retrieval Format

Report Graphics
SAS Training

Statistics Forecast
1

A,, )eve!o,ment -oo!s

5 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

SAS applications are sed in


! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Financial Ser"ices Ban#in$ I ns rance Retail Man %act rin$ Media Ed cation Co&& nications 'o"ern&ent (ospitalit) * Entertain&ent SAS Sol tions %or S&all to Medi & B sinesses Li%e Sciences (ealt+ I ns rance A to&oti"e Ener$) * ,tilities
SAS Training 8

SAS .an'ua'e /on#e,ts: @ 9he basic components of SAS language are A

SAS =iles Bata Step 2rocedure Step SAS informats SAS formats Cariables =unctions Statements (eading of (aw Bata Discellaneous .SAS 2rograms,Eutputs,%og And 0rrors/ 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

%arts of a SAS %ro'ram:


SAS programs are constructed from two basic building bloc,s. Bata step 2roc step

Bata steps and procedures are made up of one or more statements.A typical program starts with a data step to create a SAS dataset and then passes the data to a proc step for analysis.9he data step read and modify data,the proc step perform specific analysis or functions.Bata steps start with the data statement ,proc steps start with the ,eyword proc is followed by the name of the procedure.9he proc step ends with a run statement. 9he run statement indicates to SAS that the procedure or data step is complete. Starting a new data step or procedure is also ta,en by SAS as an indication that the previous one is complete .nesting of data steps andFor procedures is not allowed/.

SAS )ata .i raries


A SAS data library is a directory on your computer where SAS data sets are stored or will be stored. A library reference name .libref/ can be assigned using the libname statementA libname libref Gpath'specificationHI 9he libref must follow naming conventions and the path specified must e7ist.

What ha,,ens 0hen a SAS ,ro'ram is su mitte1?


SAS software reads the statements and chec,s them for errors Jhen it encounters a BA9A, 2(E-, or (6: statement, SAS software stops reading statements and e7ecutes the current step in the program. Page102 7 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

0ach time a step is e7ecuted, SAS software generates a log of the processing activities and the results of the processing. 9he SAS log collects messages about the processing of SAS programs and any errors that may occur. Separate sets of messages for each step in the program are produced.

Set Statement: (eads an observation from one or more SAS datasets. Set reads all
Cariables and all observations from the input datasets. A set statement -an contain multiple datasets.

Synta2: data :ew'dataset'nameI


Set old'dataset'nameI (unI 32: Bata ravi.empI Set raja.empI (unI

4,tions .ist:
1. #. 4. !. 5. 32: 1 Keep. Brop. %abel. E$S. =L(S9E$S. Bata ravi.empI Set raja.emp .E$SM4/I (unI Bata ravi.empI Set raja.emp .=L(S9E$SM4/I (unI Bata ravi.empI Set raja.emp .=L(S9E$SM4 E$SM /I (unI Bata ravi.empI Set raja.emp .BropMNob Sal/I > 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

32: 2

32: 3

32: 4

(unI 32: 5 Bata ravi.empI Set raja.emp .,eepM Nob Sal/I (unI

.a e!: Assigns descriptive labels to variables. 9he label option allows us upto #5
-haracters long in length. 32: Bata ravi.emp5 Set raja.empI %abel SalM GSA%A(OHI (unI

SAS LIST OF OPERATORS


1.ARTHIMETIC: + 2.LOGICAL : * / **(POWER) AND OR NOT 3.COMPARISION: <(LT), <=(LE),>(GT),>=(GE),^=(NE),=(EQ) 4.IN OPERATOR 5.LIKE OPERATOR 6. ETWEEN,AND OPERATOR 7.CONTAINS(!)OPERATOR 8.IS MISSING,IS N"LL OPERATOR 36A&%.3S: DATA A#A$%EMP& SET GANESH%EMP& WHERE SAL GT 2000& RUN& DATA A#A$%EMP& SET GANESH%EMP& WHERE 12*SAL GT 23000& RUN& 9 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

DATA A#A$%EMP& SET GANESH%EMP& WHERE #O ='SALESMAN'& RUN& DATA A#A$%EMP& SET GANESH%EMP& WHERE #O ='SALESMAN' RUN&

OR

#O =(ANAL$ST(&

DATA A#A$%EMP& SET GANESH%EMP& WHERE #O IN ((SALESMAN( (ANAL$ST()& RUN& DATA A#A$%EMP& SET GANESH%EMP& WHERE #O NOT IN ((SALESMAN( (ANAL$ST()& RUN& DATA A#A$%EMP& SET GANESH%EMP& WHERE COMM IS N"LL& RUN& DATA A#A$%EMP& SET GANESH%EMP& WHERE COMM IS NOT N"LL& RUN& DATA A#A$%EMP& SET GANESH%EMP& WHERE COMM IS MISSING& RUN& DATA A#A$%EMP& SET GANESH%EMP& WHERE COMM IS NOT MISSING& RUN& DATA A#A$%EMP& SET GANESH%EMP& WHERE #O =(MANAGER( AND SAL GT 4000& RUN& DATA A#A$%EMP& SET GANESH%EMP& 1" 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

WHERE ENAME LIKE (S)(& RUN& DATA A#A$%EMP& SET GANESH%EMP& WHERE ENAME LIKE ()S(& RUN& DATA A#A$%EMP& SET GANESH%EMP& WHERE #O CONTAINS (MAN(& RUN& DATA A#A$%EMP& SET GANESH%EMP& WHERE #O ! (MAN(& RUN& +F -H37 3.S3 S-A-3&37-: Synta2: Lf condition then statement'1I 0lse Statement'#I Suppose the condition is true statement'1 should be e7ecuted, otherwise statement'# should be e7ecuted. $ut not the both. 36A&%.3S:

DATA RA#A%EMP& SET GANESH%EMP(KEEP=EMPNO ENAME #O )& I* #O =(SALESMAN( THEN RANK=(*O"RTH(& ELSE I* #O =(CLERK( THEN RANK=(THIRD(& ELSE I* #O =(ANAL$ST( THEN RANK=(SECOND(& ELSE I* #O =(MANAGER( THEN RANK=(*IRST(& ELSE RANK=(NA(& RUN& DATA REENA%ST"DENT&
11 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

INP"T ROLLNO NAME+ PER& I* PER GE 60 THEN GRADE=(*IRST(& ELSE I* PER GE 50 THEN GRADE=(SECOND(& ELSE I* PER GE 40 THEN GRADE=(THIRD(& ELSE GRADE=(*AIL(& CARDS& ,-- SCOTT ./ ,-, #AMES 01 ,-0 *ORD 23 ,-1 WILL 44 ,-5 SMITH 5. &
/83A-+79 &*.-+%.3 )A-AS3-S :; *S+79 4*-%*- S-A-3&37-:

DATA RA#%MALES RA#%*EMALES& INP"T EMPNO ENAME+ GENDER+& I* GENDER=(M( THEN O"TP"T RA#%MALES& ELSE O"TP"T RA#%*EMALES& DATALINES& ,-- SCOTT M ,-, #IM M ,-0 KELL$ * ,-1 ROS$ * ,-5 DE6ID M ,-. SMITHA * RUN&
)o Statement: 9he BE statement designates a group of statements that are to be e7ecuted as a unit. 9he simplest form of the BE loop is BEI . . .SAS statements. . . 0:BI 1# 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

Synta2: Bo variableMmin to ma7I SAS StatementI 0ndI 32: Bata scott.%istI Bo :M1 to 1"I EutputI 0ndI (unI

)o Whi!e Statement: 9he BE J3L%0 statement wor,s li,e the iterative BE statement with a J3L%0 clause, e7cept that you do not specify an inde7'variable or start, stop, or increment. Synta2: Bo while .e7pression/I SAS StatementsI 0ndI 32: 1 Bata %istI :M1I .Din value/ Bo while .nPM1"/I .ma7 value F condition/ EutputI :M:?1I .increment value/ 0ndI (unI )o unti! Statement: 9he BE 6:9L% statement wor,s li,e the iterative BE statement with an 6:9L% clause, e7cept that you do not specify an inde7 variable nor start, stop, or increment. Synta2: Bo until .e7pression/I SAS StatementsI 0ndI 36A&%.3S: DATA RA#%SAMPLE& DO N"M=1 TO 10& 14 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

O"TP"T& END& RUN& DATA RA#%SAMPLE& DO N"M=2 TO 10 $ 2& O"TP"T& END& RUN& DATA RA#%SAMPLE& N=1& DO WHILE(N<=10)& O"TP"T& N=N+1& END& RUN& DATA RA#%SAMPLE& N=1& DO "NTIL(N>10)& O"TP"T& N=N+1& END& RUN&

LEAVE & CONTINUE STATEMENTS


Stops processing the current BE group or BE loop and resumes with the ne7t statement in se+uence Stops processing the current BE loop and resumes with the ne7t iteration of that BE loop

SYNTAX: CONDITION LEA6E& CONDITION CONTIN"E&

EXAMPLE:
1! 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

DATA RA#%SAMPLE& DO N=1 TO 10& I* N=7 THEN LEA6E& ELSE O"TP"T& END& RUN& DATA RA#%SAMPLE& DO N=1 TO 10& I* N=7 THEN CONTIN"E& ELSE O"TP"T& END& RUN&

SELECT S ! "#"$
E789:;8< =>8 =? <8@8ABC <;B;8D8>;< =A EA=:F< =? <;B;8D8>;< S%$ !&: SELECT <(<8C89;-87FA8<<G=>)>& WHEN-, (HI8>-87FA8<<G=>-, <%%%, HI8>-87FA8<<G=>->>) <;B;8D8>;& <%%% WHEN-> (HI8>-87FA8<<G=>-, <%%%, HI8>-87FA8<<G=>->>) <;B;8D8>;&> <OTHERWISE <;B;8D8>;&> END& EXAMPLE: DATA A#A$%EMP& SET GANESH%EMP(KEEP=EMPNO ENAME #O )& SELECT& WHEN(#O =(ANAL$ST() RANK=(SECOND(& WHEN(#O =(CLERK() RANK=(THIRD(&
15 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

WHEN(#O =(MANAGER() RANK=(*IRST(& WHEN(#O =(SALESMAN() RANK=(*O"RTH(& OTHERWISE RANK=(NA(& END& RUN&

IN-,T STYLES
There are three input styles in SAS: 1. List input 2. Column input . Formatte! input List input is the easiest" column input is a #it more $or% an! formatte! input is the har!est of the three. &o$e'er" column an! formatte! styles !o not re(uire spaces #et$een 'aria#les an! can rea! em#e!!e! #lan%s. Formatte! style can rea! special !ata such as !ates.

./COL,MN IN-,T EXAM-LES /.


DATA RA#A%EMP& INP"T EMPNO 1-3 ENAME+ #O +& CARDS& ,--SCOTT MANAGER ,-,#ONES CLERK ,-0#AMES CLERK ,-1*ORD ANAL$ST RUN& DATA RA#A%EMP& INP"T J4 ENAME+ #O +& CARDS& ,--SCOTT MANAGER ,-,#ONES CLERK ,-0#AMES CLERK ,-1*ORD ANAL$ST RUN& DATA RA#A%STATES& INP"T STKCODE+ 1-3 STKNAME+ 1-15& CARDS& ANDHRA PRADESH ASSAM 1 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

IHAR KERALA KARNATAKA TAMILNAD" RUN& DATA RA#A%ST"DENT& INP"T ROLLNO NAME+ 5-18& CARDS& ,-- RA#ESH K"MAR ,-, #AMES ,-0 #ONES ,-1 AGARWAL ,-5 SREENI6ASARAO RUN&

FORMATTED INPUT EXAMPLES


SAS S$STEM(S DE*A"LT DATE IS , ST #AN ,3/DATA RA#A%EMP& INP"T EMPNO ENAME+ SAL& ?=ADB; <BC 9=DDB%& CARDS& ,-- SCOTT 3--,-, #AMES /4-,-0 #ONES 5.-RUN& DATA RA#A%EMP& INP"T EMPNO ENAME+ SAL& *ORMAT SAL DOLLAR%& CARDS& ,-- SCOTT 3--,-, #AMES /4-,-0 #ONES 5.-RUN& DATA RA#A%EMP& INP"T EMPNO ENAME+ SAL& IN*ORMAT SAL COMMA%& CARDS& ,-- SCOTT 3,--,-, #AMES /,4-,-0 #ONES 5,.-RUN& 17 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

DATA RA#A%EMP& INP"T EMPNO ENAME+ SAL& IN*ORMAT SAL COMMA%& *ORMAT SAL COMMA%& CARDS& ,-- SCOTT 3,--,-, #AMES /,4-,-0 #ONES 5,.-RUN& DATA RA#A%EMP& INP"T EMPNO ENAME+ SAL& IN*ORMAT SAL COMMA%& *ORMAT SAL DOLLAR%& CARDS& ,-- SCOTT 3,--,-, #AMES /,4-,-0 #ONES 5,.-RUN& DATA RA#A%EMP& INP"T EMPNO ENAME+ SAL& IN*ORMAT SAL DOLLAR%& *ORMAT SAL DOLLAR%& CARDS& ,-- SCOTT +3,--,-, #AMES +/,4-,-0 #ONES +5,.-RUN& DATA RA#A%EMP& INP"T EMPNO ENAME+ DO & IN*ORMAT DO DATE4%& CARDS& ,-- SCOTT ,0#AN/,-, #AMES 01#AN/,-0 #ONES 1-OCT./ ,-1 SMITH ,0NO642 RUN& DATA RA#A%EMP& INP"T EMPNO ENAME+ DO & IN*ORMAT DO DATE4%& *ORMAT DO DATE4%& CARDS& ,-- SCOTT ,0#AN/,-, #AMES 01#AN/3 ,-0 #ONES 1-OCT./ 1> 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

,-1 SMITH ,0NO642 RUN& DATA RA#A%EMP& INP"T EMPNO ENAME+ DO & IN*ORMAT DO DATE4%& *ORMAT DO WORDDATE,0%& CARDS& ,-- SCOTT ,0#AN/,-, #AMES 01#AN/3 ,-0 #ONES 1-OCT./ ,-1 SMITH ,0NO642 RUN& DATA RA#A%EMP& INP"T EMPNO ENAME+ DO & IN*ORMAT DO DATE4%& *ORMAT DO WORDDATE,2%& CARDS& ,-- SCOTT ,0#AN/,-, #AMES 01#AN/3 ,-0 #ONES 1-OCT./ ,-1 SMITH ,0NO642 RUN& DATA RA#A%EMP& INP"T EMPNO ENAME+ DO & IN*ORMAT DO DATE4%& *ORMAT DO DDMM$$2%& CARDS& ,-- SCOTT ,0#AN/,-, #AMES 01#AN/3 ,-0 #ONES 1-OCT./ ,-1 SMITH ,0NO642 RUN& DATA RA#A%EMP& INP"T EMPNO ENAME+ DO & IN*ORMAT DO DATE4%& *ORMAT DO DDMM$$,-%& CARDS& ,-- SCOTT ,0#AN/,-, #AMES 01#AN/3 ,-0 #ONES 1-OCT./ ,-1 SMITH ,0NO642 RUN& 19 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

DATA RA#A%EMP& INP"T EMPNO ENAME+ DO & IN*ORMAT DO DATE4%& *ORMAT DO MMDD$$2%& CARDS& ,-- SCOTT ,0#AN/,-, #AMES 01#AN/3 ,-0 #ONES 1-OCT./ ,-1 SMITH ,0NO642 RUN& DATA RA#A%EMP& INP"T EMPNO ENAME+ DO & IN*ORMAT DO DATE3%& *ORMAT DO DATE3%& CARDS& ,-- SCOTT ,0-#AN-/,-, #AMES 01-#AN-/3 ,-0 #ONES 1--OCT-./ ,-1 SMITH ,0-NO6-42 RUN& DATA RA#A%EMP& INP"T EMPNO ENAME+ DO & IN*ORMAT DO DATE3%& *ORMAT DO DATE4%& CARDS& ,-- SCOTT ,0-#AN-/,-, #AMES 01-#AN-/3 ,-0 #ONES 1--OCT-./ ,-1 SMITH ,0-NO6-42 RUN& DATA RA#A%EMP& INP"T EMPNO ENAME+ DO & IN*ORMAT DO DATE3%& *ORMAT DO DATE4%& CARDS& ,-- SCOTT ,0/#AN//,-, #AMES 01/#AN//3 ,-0 #ONES 1-/OCT/./ ,-1 SMITH ,0/NO6/42 RUN& Page102 DATA RA#A%EMP& INP"T EMPNO ENAME+ DO & IN*ORMAT DO DATE3%& #" 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

*ORMAT DO CARDS& ,-- SCOTT ,-, #AMES ,-0 #ONES ,-1 SMITH RUN&

MMDD$$2%& ,0/#AN//01/#AN//3 1-/OCT/./ ,0/NO6/42

DATA RA#A%EMP& INP"T EMPNO ENAME+ DO & IN*ORMAT DO MMDD$$2%& *ORMAT DO MMDD$$2%& CARDS& ,-- SCOTT ,0/01//4 ,-, #AMES ,,/1-//3 ,-0 #ONES -3/-3/./ ,-1 SMITH ,0/,0/42 RUN& DATA RA#A%EMP& INP"T EMPNO ENAME+ TO & IN*ORMAT TO TIME2%& *ORMAT TO TIME2%& CARDS& ,-- SCOTT ,0:01:5. ,-, #AMES ,,:1-:,3 ,-0 #ONES 00:-3:./ ,-1 SMITH ,0:,0:,0 RUN&

In%ile state&ent A> I>?GC8 <;B;8D8>; ;8CC< <B< ;I8 ?GC8 ?GC8 9=>;BG>G>E ;I8 ;I8 ?GC8 FB;I B>L O:=;B;G=>< =A L=:PC8

G< :<8L ?=A 87;8A>BC ?GC8< B>L >BD8 B>L FB;I =? ;I8 87;8A>BC LB;B%A?;8A ;I8 G>?GC8 M8NH=AL >BD8 BA8 8>9C=<8L G> <G>EC8 O:=;B;G=><%

DATA NAG%EMP& IN*ILE 'D:QEMP,%TRT'& INP"T EMPNO ENAME+ #O + SAL& RUN& DATA NAG%EMP& IN*ILE 'D:QEMP0%TRT' DLM=','& Page102

#1 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

INP"T EMPNO ENAME+ #O + SAL& RUN& DATA NAG%EMP& IN*ILE 'D:QEMP1%TRT' DLM='JS+)T'& INP"T EMPNO ENAME+ #O + SAL& RUN& DATA NAG%EMP& IN*ILE 'D:QEMP5%TRT' ERPANDTA S& INP"T EMPNO ENAME+ #O + & RUN& DATA NAG%EMP& IN*ILE 'D:QEMP.%TRT' DSD& INP"T EMPNO ENAME+ #O + SAL& RUN&

CREATIN' MULTIPLE O(SERVATIONS


DATA RA#%EMP& INP"T EMPNO ENAME+ #O + JJ& CARDS& ,-- SCOTT MANAGER ,-, *ORD CLERK ,-0 #ONES CLERK ,-1 *ORD ANAL$ST ,-5 SMITH MANAGER ,-. WARD CLERK RUN&
ARRAY STATEMENT0 An array statement can #e use! to perform the same tas% on a group of 'aria#les. S)nta10 Array name )si*e+ ,'alues-. E10 Page102 Data ra/a. sample. Array a)10+ ,1 2 5un. ## 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! 1 2 6 3 8 4 10-.

E10 Data ra/a.sample. Array a)10+. Do n61 to !im,a-. A)n+6n. 7n!. 5un.

'OTO STATEMENT0
T&7 89T9 STAT7:7;T T9 &A<7 SAS =59C7SS STAT7:7;TS >; S9:7 9T&75 =A5T 9F ?9@5 =5985A:" A? =59<>D>;8 A LAA7L F9LL9B7D A? A C9L9; A7F957 T&7 STAT7:7;TS ?9@ B>S& T9 C@:= T9. S;7-A6: 94-4 label; Jhere label is a labeled statement. 07ecution jumps to this statement. A label is a name followed by a colon .A/. EX:

DATA REENA%EMP& SET GANESH%EMP& I* COMM NE N"LL THEN GOTO A C& P"T 'COMM IS N"LL'& A C: I* COMM GT 500 THEN O"TP"T& RUN&

SAS )*$+ ,-$.


Page102 #4 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Jhen planning modifications to SAS datasets, e7amine the many SAS functions that are available SAS has many built in functions that greatly reduce the need to enter commands SAS functions are pre'written e7pressions that provide shortcuts for many calculations and manipulations of data

/0 ART1IMETIC FUNCTIONS0/ DATA #OHN%SAMPLE& A=10& =3& R=MOD(A, )& RUN& DATA #OHN%TEST& DO N=1 TO 10& I* MOD(N,2)=0 THEN RES"LT=(E6EN(& ELSE RES"LT=(ODD(& O"TP"T& END& RUN& DATA RA#A%SAMPLE& A=-100& =A S(A)& RUN& DATA RA#A%SAMPLE& A=2& =ERP(A)& RUN& /0 STATISTICAL FUNCTIONS 0/ DATA #OHN%TEST& A=1& =2&C=3&D=4& TOTAL=S"M(A, ,C,D)& MIN=MIN(A, ,C,D)& CO"NT=N(A, ,C,D)& MAR=MAR(A, ,C,D)& #! 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

A6G=MEAN(A, ,C,D)& STD=STD(A, ,C,D)& RUN& DATA #OHN%TEST& A=100& =23& C=34& D=78& RANGE=RANGE(A, ,C,D)& RUN& /0 TRUNCATION FUNCTIONS 0/ DATA A#A$%SAMPLE& A=10.456782& =CEIL(A)& C=*LOOR(A)& D=INT(A)& E=RO"ND(A)& RUN& DATA A#A$%SAMPLE& A=10.56782& =CEIL(A)& C=*LOOR(A)& D=INT(A)& E=RO"ND(A)& RUN&

/0 C1ARCATER FUNCTIONS 0/ DATA #OHN%SAMPLE& NAME=(SCOTT(& M$NAME=LOWCASE(NAME)& RUN& DATA #OHN%SAMPLE& NAME=(<9=;;(& M$NAME="PCASE(NAME)& RUN& DATA #OHN%SAMPLE& NAME=(<9=;;(& M$NAME=FA=F9B<8(NAME)& RUN& #5 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

DATA #OHN%EMP& SET GANESH%EMP(KEEP=EMPNO ENAME)& LENGTH=LENGTH(ENAME)& RUN& DATA #OHN%EMP& *AR=(,0-15-./(& M$*AR=COMPRESS(*AR,(-()& RUN& DATA #OHN%EMP& NAME=(#OHN DE6ID(& M$NAME=COMPRESS(NAME,(D()& RUN& DATA #OHN%EMP& NAME=(#OHN DE6ID(& M$NAME=COMP L(NAME)& RUN& DATA #OHN%TEST& SET GANESH%EMP(KEEP=EMPNO ENAME #O )& #KCODE=S" STR(#O ,1,3)& RUN& DATA #OHN%TEST& *NAME=(DE6ID(& LNAME=(THOMAS(& NAME=CAT(*NAME,LNAME)& RUN& DATA #OHN%TEST& NAME=(THOMAS #OHN DE6ID(& *KNAME=SCAN(NAME,1)& MKNAME=SCAN(NAME,2)& LKNAME=SCAN(NAME,3)& RUN& DATA #OHN%TEST& *NAME=(DE6ID(& LNAME=(THOMAS(& NAME=*NAMEUU( (UULNAME& RUN& DATA #OHN%EMP& SET GANESH%EMP& #O =RIGHT(#O )& ENAME=RIGHT(ENAME)& # 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

RUN& DATA #OHN%EMP& INP"T EMPNO ENAME+5-17& ENAME=RIGHT(ENAME)& CARDS& ,-- RA#ESH K"MAR ,-, SCOTT ,-0 THOMAS #AMES ,-1 #ONES PETER & DATA A#A$%SAMPLE& NAME=(#OHN THOMAS DE6ID(& POSITINKD=INDER(NAME,(D()& RUN&

/0 DATE & TIME FUNCTIONS0/ DATA A#A$%SAMPLE& DO =323OCT823D& $EAR=$EAR(DO )& MONTH=MONTH(DO )& DA$=DA$(DO )& WEEKDA$=WEEKDA$(DO )& *ORMAT DO DATE3%& RUN& DATA RA#A%SAMPLE& DO TO =323OCT56:22:12:453DT& DO =DATEPART(DO TO )& TO =TIMEPART(DO TO )& *ORMAT DO TO DATETIME,2%& *ORMAT DO DATE4%& *ORMAT TO TIME2%& RUN& DATA A#A$%SAMPLE& D,=DATE()& D0=TODA$()& *ORMAT D, D0 DATE3%& RUN& DATA RA#A%SAMPLE& #7 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

DO =MD$(12,23,78)& *ORMAT DO DATE3%& RUN& INTC4567 S$NTAR: INTCK (($EAR(/(MONTH(/(DA$(,*ROM,TO)& 36: DATA SAMPLE& DO#=323OCT673D& DOR=330NOV823D& *ORMAT DO# DOR DATE3%& SER6ICE=INTCK('$EAR',DO#,DOR)& RUN& DATA SAMPLE& DO#=323OCT673D& DOR=330NOV823D& *ORMAT DO# DOR DATE3%& SER6ICE=INTCK('MONTH',DO#,DOR)& RUN& DATA SAMPLE& DO#=323OCT673D& DOR=330NOV823D& *ORMAT DO# DOR DATE3%& SER6ICE=INTCK('DA$',DO#,DOR)& RUN& DG??8A8>98 P8;H88> ;H= LB;8 @BC:8<

-roced res
-roc Delete0 The !elete proce!ure !eletes an eDisting !ataset from a SAS li#rary. S)nta10 =roc !elete !ata 6 SAS E !ata E set. 5un. E10 =roc !elete !ata 6 latha.emp. 5un.

#> 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

-roc s &&ar): The summary proce!ure prints ho$ many o#ser'ations are there in a =articular !ata set. S)nta10 =roc summary print !ata 6 SAS E !ata E set. 5un. E10 =roc summary print !ata6 5a/a.emp. 5un.

-roc &eans0 The means proce!ure pro'i!es simple statistics on numeric 'aria#les. S)nta10 =roc means !ata 6 SAS E !ata E set. <ar 'aria#le E list. Ay 'aria#le E list. 5un. E1a&ple0 PROC MEANS DATA8'ANES1.EMP9 RUN9 E1a&ple0 PROC MEANS DATA8'ANES1.EMP9 VAR SAL COMM9 RUN9 -ROC CO-Y0 The copy proce!ure copies one or more sas !atasets from one li#rary to another li#rary. S)nta10 =roc copy in6li#name out6li#name. Select !atasetF1 !atasetF2FFFFFFFFFFFF. 5un. E1a&ple0 PROC COPY IN=GANESH O"T=RA#A& SELECT EMP DEPT& RUN& PROC COPY IN=GANESH O"T=RA#A& RUN& Page102 -ROC DATASETS0 @sing this proce!ure $e can change an eDisting !ataset name. #9 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

S)nta10 =roc !atasets li#6name. Change ol!Fname6ne$Fname. 5un. E1a&ple0 PROC DATASETS LI =GANESH& CHANGE EMP=M$EMP& RUN& -roc sort0 T+ere are &an) reasons %or sortin$ )o r data0 a- To organi*e !ata for a report. #- Aefore com#ining !ata sets. c- Aefore using a #y statement in another proce!ure or !ata step. S)nta10 =roc sort !ata 6 SAS E !ata E set. Ay 'ar1 'ar2 'ar GGGGGG. 5un. The 'aria#les name! in the #y statements are calle! #y 'aria#les. E10 2 =roc sort !ata 6 latha.emp. Ay ename. 5un. E10 2 =roc sort !ata 6 latha.emp. Ay Sal. 5un. E10 3 =roc sort !ata 6 latha.emp. Ay !escen!ing Sal. 5un. E10 4 =roc sort !ata 6 latha.emp. Ay /o#. 5un. E10 5 =roc sort !ata 6 latha.emp out 6 latha.ne$Hemp. Ay /o#. 5un. -roc Contents: This proce!ure prints !escriptions of the contents of one or more files from the SAS li#rary. S)nta10 =roc contents !ata 6 SAS E !ata E set. 4" 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

5un. E1a&ple0 PROC CONTENST DATA=GANESH%EMP& RUN& -roc Append: The appen! proce!ure a!!s the o#ser'ations from one SAS !ataset to 7n! of another SAS !ata set. S)nta1: proc appen! #ase 6 SAS E !ata E set !ata6SAS E !ataset name. 5un. Condition0 Aoth the !ata sets contains e(ual no. of columns of same !ata type. S)nta10 =roc appen! #ase 6 latha.#an%1 !ata 6 latha.#an%2. run. -roc plot0 simple lo$ resolution graphs can #e o#taine! using #ase SAS proce!ures =lot an! chart. S)nta10 =roc plot !ata 6 SAS E !ata E set. =lot <'aria#le I &'aria#le. 5un. E10 =roc plot !ata 6 5a/a.emp. =lot /o#I!eptno. 5un. -roc c+art0 The chart proce!ure pro!uces 'ertical an! hori*ontal #ar Charts" pie charts an! star charts. S)nta10 =roc chart !ata 6 SAS E !ata E set. =ie 'aria#le ,s- Joption,s-K. <Aar 'aria#le ,s- Joption,s-K. &Aar 'aria#le ,s- J option,s-K. Aloc% 'aria#le ,s- J option,s-K. 5un.

E10 =roc chart !ata 6 5a/a.emp. <Aar /o#. 5un. =roc chart !ata 6 5a/a.emp. &Aar /o#. 41 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102 E10

5un. E10 E10 =roc chart !ata 6 5a/a.emp. Aloc% /o#. 5un. -roc print0 The print proce!ure is perhaps the most $i!ely use! SAS proce!ure.The print proce!ure prints all the 'aria#les for all o#ser'ations in the SAS Datasets. S)nta10 =roc print !ata 6 SAS E !ata Eset. <ar 'aria#le E list. Sum 'aria#le E list. Ay 'aria#le E list. 5un. E10 2 =roc print !ata 6 5a/a.emp. 5un. E10 2 =roc print !ata 6 5a/a.emp. <ar empno Sal /o#. 5un. E10 3 =roc print !ata 6 5a/a.emp ,o#s6 -. <ar empno Sal /o#. 5un. =roc print !ata 6 5a/a.emp. <ar empno Sal /o#. Sum Sal. 5un. =roc chart !ata 6 5a/a.emp. =ie /o#. 5un.

E10 4

E10 5 =roc sort !ata 6 5a/a.emp. Ay /o#. 5un. =roc print !ata 6 5a/a.emp. Ay /o#. 5un. Page102 Note0 6 Ay 'aria#le shoul! #e pre sorte!.

4# 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

-roc For&at0 The format proce!ure creates formats that $ill later #e associate! $ith <aria#les in a format statement. The format proce!ure prints formatte! <alues instea! of their co!es. -ROC FORMAT . <AL@7 L;A:7 5A;87F26MF95:ATT7DFT7NTF1M 5A;87F26MF95:ATT7DFT7NTF2M FFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFF. The name in the 'alue statement is the name of the format you are creating. >f the format is for character !ata" the name must start $ith a !ollar sign. E1a&ple0 -ROC FORMAT . <AL@7 LAAC M:M6M:AL7M MFM6MF7:AL7M. DATA C9&;.7:=. >;=@T 7:=;9 7;A:7L 87;D75L. F95:AT 87;D75 AAC.. CA5DS. 100 SC9TT : 101 CA:7S : 10 59S? F 101 ACA? : 102 O7LL? F 5@;. E1a&ple0 -ROC FORMAT . <AL@7 AAC 26:AL7 76F7:AL7. DATA C9&;.7:=. >;=@T 7:=;9 7;A:7L 87;D75. F95:AT 87;D75 AAC.. CA5DS. 100 SC9TT 1 101 CA:7S 1 10 59S? 0 101 ACA? 1 102 O7LL? 0 5@;.

44 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

-ROC FRE80 -ROC FRE8 DATA6SASFDATAFS7T. TAAL7S <A5>AAL7FC9:A>;AT>9;S. R,N. PI 9;7 BA? F57Q TAAL7 IP E1a&ple0 -ROC FRE8 DATA68A;7S&.7:=. TAAL7S C9A. R,N. PI TB9 BA? F57Q TAAL7 IP E1a&ple0 -ROC FRE8 DATA68A;7S&.7:=. TAAL7S C9AID7=T;9. R,N. -roc IM-ORT * EX-ORT0 The >mport R 7Dport proce!ures can transfers the !ata #et$een SAS an! eDternal !ata source. These eDternal !ata sources can inclu!e DA:S files" =C files R Delimite! TeDt files. S)nta10 -ROC IM-ORT DATAF>L76SF>L7;A:7S 9@T6SASFDATAFS7T DA:S6>D7;T>F>75 57=LAC7. R,N. E1a&ple0 -ROC IM-ORT DATAF>L76SC:T7:=.NLSS 9@T6C9&;.7:= DA:S67NC7L 57=LAC7. R,N. S)nta10 -ROC EX-ORT DATA6SASFDATAS7T 9@TF>L76SF>L7;A:7S DA:S6>D7;T>F>75 57=LAC7. R,N. E1a&ple0 -ROC EX-ORT DATA68A;7S&.7:= 9@TF>L76SD:T7:=.NLSS DA:S67NC7L 57=LAC7. R,N. E1a&ple0 4! 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

-ROC EX-ORT DATA68A;7S&.7:= 9@TTAAL76S7:=S DA:S6ACC7SS 57=LAC7. DATAAAS76SC:TSC9TT.:DAS. R,N. E1a&ple0 -ROC IM-ORT TAAL76S7:=S 9@T6C9&;.7:= DA:S6ACC7SS 57=LAC7. DATAAAS76SC:TSC9TT.:DAS. R,N. COM-ARE -ROCED,RE The compare proce!ure compares any t$o sas !atasets or 'aria#les $ith in the same !ataset. -ROC COM-ARE AAS76SASFDATAFS7T C9:=A576SASFDATAFS7T. A? <A5>AAL7S. R,N. E1a&ple0

PROC COMPARE $ ROLLNO& RUN&

ASE=GANESH%SEM,

COMPARE=GANESH%SEM0&

-ROC -RINTTO The printto proce!ure #ypasses the program output into another specifie! location. S)nta10 -roc printto file6SfileFpathS. E1a&ple0 -roc printto file6Sc:Tgeetha.tDtS. -roc print !ata6ganesh.emp. r n. UPDATIN' T1E MASTER DATA SET (Y USIN' TRANSACTION DATASET S$NTAR: DATA MASTER-DATA-SET& "PDATE MASTER-DATA-SET $ 6AR& TRANS-DATA-SET&

45 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

RUN& DATA A#A$%EMP& INP"T EMPNO ENAME+ SAL& CARDS& ,-- SCOTT 3--,-, #ONES 24-,-0 #AMES 1--,-1 SMITH 4--,-5 KELL$ /4-,-. WARD 3--& DATA A#A$%NEWKEMP& INP"T EMPNO SAL& CARDS& ,-- ,---,-0 .--,-5 3--& EX: PROC SORT DATA=A#A$%EMP& $ EMPNO& PROC SORT DATA=A#A$%NEWKEMP& $ EMPNO& :*$& DATA A#A$%EMP& "PDATE A#A$%EMP $ EMPNO& RUN& A#A$%NEWKEMP&

Mer$in$0 :erging are t$o types:


1. 9neFtoF9ne merging 2. :atch merging 1- 9neFtoF9ne merging com#ines o#ser'ations from t$o or more SAS !ata sets into a Single o#ser'ation in a ne$ !ata set .To perform a one to one merging use the :erge statement $ithout a #y statement. S)nta10 :erge SAS E !ata E set,s-. 7D: Data latha.result. :erge latha. Stu!ent latha. :ar%s.
4 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

5un. 29: Matc+ &er$in$0 :atch merge com#ines o#ser'ations from t$o or more SAS Data sets into a single o#ser'ation in a ne$ !ata set accor!ing to the 'alues of a Common 'aria#le. The no of o#ser'ations in a ne$ !ata set is the sum of largest no of o#ser'ations in each #y group in all !ata sets. S)nta10 :erge SAS E !ata E set,s-. Ay 'aria#le,s-. Note0 The #y 'aria#le,s- shoul! #e presorte!.
E1a&ple0 DATA A#A$%ST"DENT& INP"T ROLLNO NAME+& CARDS& ,-- SCOTT ,-, SMITH ,-0 *ORD ,-1 #AMES ,-5 #ONES RUN& DATA A#A$%MARKS& INP"T ROLLNO PER& CARDS& ,-- 3,-, 15 ,-0 // ,-1 42 ,-5 2, RUN& DATA A#A$%RES"LT& MERGE A#A$%ST"DENT RUN& E1a&ple0 DATA A#A$%ST"DENT& INP"T ROLLNO NAME+& CARDS& ,-- SCOTT ,-, SMITH ,-0 *ORD 47 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! A#A$%MARKS&

Page102

,-1 #AMES ,-5 #ONES RUN& DATA A#A$%MARKS& INP"T ROLLNO PER& CARDS& ,-- 3,-0 // ,-5 2, RUN& PROC SORT DATA=A#A$%ST"DENT& $ ROLLNO& PROC SORT DATA=A#A$%MARKS& $ ROLLNO& DATA A#A$%RES"LT& MERGE A#A$%ST"DENT A#A$%MARKS& $ ROLLNO& RUN&

PUT STATEMENT:
TI8 F:; <;B;8D8>; FAG>;< ;I8 CG>8< ;= ;I8 SAS L=E WG>L=H% E1a&ple0 DATA RA#%EMP& SET GANESH%EMP(KEEP=EMPNO ENAME #O )& P"T J3 EMPNO J12 ENAME J23 #O & RUN& E1a&ple0 DATA RA#%EMP& SET GANESH%EMP(KEEP=EMPNO ENAME #O )& *ILE PRINT& P"T J3 EMPNO J12 ENAME J23 #O & RUN& E1a&ple0 DATA RA#%EMP& SET GANESH%EMP(KEEP=EMPNO ENAME #O )& *ILE 'D:QM$REPORT%TRT'& P"T J3 EMPNO J12 ENAME J23 #O & RUN&

STOP & ERROR STATEMENTS:


4> 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

>T >S S9:7T>:7S @S7F@L T9 9<755>D7 SAS D7FA@LT A7&A<>95 9F =59C7SS>;8 A; 7;T>57 S7T 9F DATA STAT7:7;TS F95 7AC& 9AS75<AT>9;.75595 STAT7:;T =5>;TS A :7SSA87 T9 T&7 SAS L98 B>;D9B. T&7 ST9= STAT7:7;T >::7D>AT7L? D>SC9;T>;@7 7;T>57 7N7C@T>9; 9F T&7 DATA ST7=. E1a&ple0 DATA REENA%EMP& SET GANESH%EMP(KEEP=EMPNO ENAME #O I* #O = (MANAGER( THEN DO& ERROR 'EREC"TION STOPPED'& STOP& END& RUN&

SAL)&

)+S%.A; &A7A938 /4&&A7)S: 6se the command line by typing the command on the command line .%ocated at the top of the window/ and press enter.

/omman1 .ine 1. -lear #. Keys 4. $ye !. Submit 5. (ecall . <oom 7. 2rogram >. %og 9. Eutput '' '' '' '' '' '' '' '' ''

)es#ri,tion -lear contents of window. Bisplays ,eys window. 0nd SAS Session. Submit SAS 2rogram for processing. (ecall Submitted program statements to 2rogram 0ditor. -hange the Size of Jindow. Bisplay program 0ditor. Bisplay %og window. Bisplay output Jindow.

49 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

SAS<83%48-S
4 =e#tives:

1. #. 4. !.

6se the report procedure to create a listing report. Apply the order usage type to sort the data on a listing report. Apply the sum and group usage types to create a summary report. 6se the ($rea, statement to produce a grand total.

Features: 1. #. 4. !. -reating listing reports. -reate summary reports. 0nhance reports. (e+uest separate subtotals and grand totals. proc report dataMSAS'Bata'setPoptionsQI (unI

Synta7A 4,tions:

1. Jindows F JB'Lnvo,e the procedure in an interactive report window .Befault/. #. :owindows F :owd' displays the report in the EF2 window. 07A1 2roc (eport dataMoracle.empI (unI 32:2 2roc (eport dataMoracle.emp :owdI (unI %rintin' Se!e#te1 "aria !es : *se a #o!umn statement to Page102 1. Select the variables to appear in the report. #. order the variables in the report. Synta2: #o!umn SAS>"aria !es 5 !" 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

32: 2roc report dataMoracle.empI -olumn empno job SalI (unI )efine Statement: Oou can enhance the report by using define statement to 1. #. 4. !. Befine how each variable is used in the report. Assign formats to variables. Specify report column headers and column widths. -hange the order of the rows in the report.

Synta7A Befine Cariables F PusageQ Pattribute'listQI 32:1 2roc report dataMoracle.empI -olumn empno job SalI Befine Sal F formatMBollar1". GSalaryHI (unI 4r1er *sa'e ty,e: Erder the report in ascending order, include the descending option in the define statement to force the order to be descending. 32: 2roc report dataMoracle.empI -olumn empno job SalI Befine Sal F format M Bollar1". GSalaryHI Befine Nob F Bescending order GBesignationHI (unI Befine Analysis CariablesA 9o Specify a statistic other than sum, type the name of the statistic after the F in the defining statement, Befine Sal F Dean formatMBollar1". I %rintin' 'ran1 tota!s: ;ou #an an 8:rea$ Statement to a11 a 1. 1rand total to the top or bottom of the report . #. %ine before the grand total. 4. %ine after the grand total. Page102 Synta2: 8:rea$ :efore < after ?o,tions@5 4,tions:

!1 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

1. #. 4. !. 5.

Summarize ; prints the total. E% ; prints a Single %ine above the total. BE% ; prints a double %ine above the total. 6% ; prints a single %ine below the total. B6% ; prints a double %ine below the total.

32: *se the 8:rea$ statement to 1is,!ay the 'ran1 tota! at the ottom of the re,ort. 2roc report dataM oracle.empI -olumn empno job SalI Befine Sal F formatMBollar1". GSalaryHI ($rea, after F summarize BE%I (unI 0nhancing the (eportA 6se the headline and head s,ip options in the proc report statement to ma,e the report more readable. 32: 2roc (eport BataMoracle.emp 3ead line 3ead s,ipI -olumn empno job SalI Befine Sal F formatMdollar1". GSalaryHI (unI

3638/+S3 PROC REPORT DATA=GANESH%EMP NOWD HEADLINE& COL"MN EMPNO #O SAL& DE*INE SAL/(SALAR$( *ORMAT=COMMA%& RUN& PROC REPORT DATA=GANESH%EMP NOWD HEADLINE& COL"MN EMPNO #O SAL& DE*INE SAL/(SALAR$( *ORMAT=DOLLAR,-%& RUN& PROC REPORT DATA=GANESH%EMP NOWD HEADLINE& COL"MN EMPNO #O SAL& DE*INE SAL/(SALAR$( *ORMAT=DOLLAR,-%& DE*INE #O /WIDTH=20& RUN&
!# 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

PROC REPORT DATA=GANESH%EMP NOWD HEADLINE& COL"MN #O SAL& DE*INE #O /GRO"P& DE*INE SAL/(S"MKSAL(& RUN& PROC REPORT DATA=GANESH%EMP NOWD HEADLINE& COL"MN DEPTNO SAL& DE*INE DEPTNO/GRO"P& DE*INE SAL/(S"MKSAL(& RUN& PROC REPORT DATA=GANESH%EMP NOWD HEADLINE& COL"MN DEPTNO #O SAL& DE*INE DEPTNO/GRO"P& DE*INE #O /GRO"P& DE*INE SAL/(S"MKSAL(& RUN& PROC REPORT DATA=GANESH%EMP NOWD HEADLINE& COL"MN DEPTNO #O SAL& DE*INE DEPTNO/GRO"P& RUN& PROC REPORT DATA=GANESH%EMP NOWD HEADLINE& COL"MN DEPTNO #O SAL& DE*INE DEPTNO/GRO"P& R REAK A*TER/OL S"MMARIVE& R REAK A*TER/"L& RUN& PROC REPORT DATA=GANESH%EMP NOWD HEADLINE& COL"MN DEPTNO #O SAL& DE*INE DEPTNO/GRO"P&
!4 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

REAK A*TER DEPTNO/OL S"MMARIVE SKIP S"PPRESS& RUN& PROC REPORT DATA=GANESH%EMP NOWD HEADLINE& COL"MN DEPTNO #O SAL& DE*INE DEPTNO/GRO"P& REAK A*TER DEPTNO/OL S"MMARIVE SKIP S"PPRESS& REAK A*TER DEPTNO/"L& RUN& PROC REPORT DATA=GANESH%EMP NOWD HEADLINE& COL"MN DEPTNO #O EMPNO ENAME SAL& DE*INE DEPTNO/GRO"P& DE*INE EMPNO/DISPLA$& REAK A*TER DEPTNO/OL S"MMARIVE SKIP S"PPRESS& REAK A*TER DEPTNO/"L& RUN&
-A:*.A-+47
4 =e#tives: 1. -reating one and two dimensional tabular reports using tabulate procedure. #. 2roduce totals for one dimension. 4. produce totals for both dimension. Synta2: proc tabulate BataMSAS'Bata setPoptionsQI -lass -lassRCariablesI Car analysisRvariablesI 9able rowRe7pression, columnRe7pression P optionsQI (unI A -lass statement or a var statement must be specified. $ut, both statements together are not re+uired. A -lass statement identified variables to be used as Page102

!! 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

class fication, or grouping variables e7ample of class variables are location, gender and job class variables can be numeric or character. A var statement identifies variables to be used as analysis variables. 07amples of analysis variables are salary, profit and loss analysis variables are analysis numeric.A 9able statement identifies table stature and format. 07A 2ro tabulate dataMoracle.empI -lass jobI 9able jobI (unI 4 tainin' a -ota!: 9he All ,ey word can be used to generate a total. 07A 2roc 9abulate BataMoracle.empI -lass jobI 9able job allI (unI -0o )imensiona! -a !es: 9he comma in the table statement directs the table to move to a different dimension. 07A 2roc 9abulate BataMoracle.empI -lass Beptno jobI 9able Beptno, jobI (unI 4 tainin' a -ota!: 9he All ,eyword generates a total for the dimension in which it is specified. Su settin' the )ata: 9he where statement can be used in proc tabulate to sub set the data. *sin' Ana!ysis "aria !es: 9he asteri, GSH operator in the table statement is used to nest information, if there are analysis variables in the table statement, the default statistic is sum. Formattin' the Statisti# 1ata: 9o format the statistics in the cells, use the format option in the proc tabulate statement. !5 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

S,e#ifyin' a Statisti#: 9o specify different stats in the cells, follow the analysis variable with the asteri, operator and the desired statistics.

3638/+S3
PROC TA(ULATE DATA=GANESH%EMP& CLASS #O & TA LE #O & RUN& PROC TA(ULATE DATA=GANESH%EMP *ORMAT=2.& CLASS #O & TA LE #O & RUN& PROC TA(ULATE DATA=GANESH%EMP *ORMAT=2.& CLASS #O & TA LE #O ALL& KE$LA EL ALL=TOTAL& RUN& /* TWO DIMENSIONAL TA "LAR REPORTS */ PROC TA(ULATE DATA=GANESH%EMP *ORMAT=2.& CLASS #O DEPTNO& TA LE #O ,DEPTNO/MISSTERT=(NA(& KE$LA EL ALL=TOTAL& RUN& PROC TA(ULATE DATA=GANESH%EMP *ORMAT=2.& CLASS #O DEPTNO& TA LE #O ALL,DEPTNO ALL/MISSTERT=(-(& KE$LA EL ALL=TOTAL& RUN& PROC TA(ULATE DATA=GANESH%EMP *ORMAT=2.& WHERE DEPTNO IN (10,20)& CLASS #O DEPTNO& TA LE #O ALL,DEPTNO ALL/MISSTERT=(-(& KE$LA EL ALL=TOTAL& RUN& ! 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

TITLE 'S"M O* ALL SALARIES'& PROC TA(ULATE DATA=GANESH%EMP *ORMAT=2.& CLASS #O DEPTNO& 6AR SAL& TA LE DEPTNO*#O ,SAL& KE$LA EL ALL=TOTAL& RUN& TITLE 'S"M O* ALL SALARIES'& PROC TA(ULATE DATA=GANESH%EMP *ORMAT=DOLLAR3%& CLASS #O DEPTNO& 6AR SAL& TA LE DEPTNO*W=P,SAL/MISSTERT=(NA(& KE$LA EL ALL=TOTAL& RUN& TITLE 'S"M O* ALL SALARIES'& PROC TA(ULATE DATA=GANESH%EMP *ORMAT=DOLLAR3%& CLASS #O DEPTNO& 6AR SAL& TA LE DEPTNO*W=P,SAL /MISSTERT=(NA(& KE$LA EL ALL=TOTAL& RUN& TITLE 'MEAN O* ALL SALARIES'& PROC TA(ULATE DATA=GANESH%EMP *ORMAT=DOLLAR3%& CLASS #O DEPTNO& 6AR SAL& TA LE DEPTNO*W=P,SAL *MEAN/MISSTERT=(NA(& KE$LA EL ALL=TOTAL& RUN& PROC TA(ULATE DATA=GANESH%EMP *ORMAT=2.& CLASS #O DEPTNO& 6AR SAL COMM& TA LE DEPTNO*#O ALL,ALL(SAL COMM)/MISSTERT=(NA(& KE$LA EL ALL=TOTAL& LA EL SAL=SALAR$ COMM=COMMISION& RUN& PROC TA(ULATE DATA=GANESH%EMP *ORMAT=2.& CLASS #O DEPTNO& 6AR SAL COMM& TA LE DEPTNO*#O ALL,ALL(SAL COMM)*(MIN MAR MEAN)/MISSTERT=(NA(& KE$LA EL ALL=TOTAL& !7 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

LA EL SAL=SALAR$ COMM=COMMISION& RUN& PROC TA(ULATE DATA=GANESH%EMP *ORMAT=2.& CLASS #O DEPTNO& 6AR SAL COMM& TA LE DEPTNO*(#O ALL)ALL,ALL(SAL COMM)*(MIN MAR MEAN)/MISSTERT=(NA(& KE$LA EL ALL=TOTAL& LA EL SAL=SALAR$ COMM=COMMISION& RUN&

SAS/ODS
ODS means output delivery system. A system that delivers output in a variety of easy-to-access formats, such as SAS data sets, listing files, or Hypertext Markup anguage !H"M #. Features:

$. Avoid transcription errors %. &roduce periodic reports '. &rofessional appearance for reports and graphs (. Archive results of analysis

)e can generate output in ( different file formats*

$. H"M !hyper text markup language# %. +", '. &D, (. .M !+ich text format# !&orta-le document format# !/xtensi-le ,ile ,ormat#

Ods rtf file 01filename.rtf12 !> 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

Sending SAS output to a *.rtf file:

Sas procedure statements2 Ods rtf close2

Sending SAS output to a *.html file:

Ods html file 01filename.html12 Sas procedure statements2 Ods html close2 Sending SAS output to a *.pdf file:

Ods pdf file 01filename.pdf12 Sas procedure statements2 Ods pdf close2

/.* $ ODS PD* *ILE='D:QM$REPORT%PD*'& PROC TA(ULATE DATA=GANESH%EMP *ORMAT=2.& CLASS #O DEPTNO& TA LE #O ALL,DEPTNO ALL/MISSTERT=(-(& RUN& ODS PD* CLOSE& ER: 0 ODS HTML *ILE='D:QM$REPORT%HTML'& PROC TA(ULATE DATA=GANESH%EMP *ORMAT=2.& CLASS #O DEPTNO& TA LE #O ALL,DEPTNO ALL/MISSTERT=(-(& RUN& ODS HTML CLOSE& ER: 1 ODS RT* *ILE='D:QM$REPORT%RT*'& PROC TA(ULATE DATA=GANESH%EMP *ORMAT=2.& CLASS #O DEPTNO& TA LE #O ALL,DEPTNO ALL/MISSTERT=(-(&
!9 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

RUN& ODS RT* CLOSE& ER: 5 ODS PD* *ILE='D:QM$REPORT%PD*'& ODS HTML *ILE='D:QM$REPORT%HTML'& ODS RT* *ILE='D:QM$REPORT%RT*'& PROC TA(ULATE DATA=GANESH%EMP *ORMAT=2.& CLASS #O DEPTNO& TA LE #O ALL,DEPTNO ALL/MISSTERT=(-(& RUN& ODS RT* CLOSE& ODS HTML CLOSE& ODS PD* CLOSE& ER: . ODS PD* *ILE='D:QM$GRAPH%PD*'& TITLE C= L"E H=3 *= R"SH 'EMPLO$EE IN*ORMATION'& PROC 'C1ART DATA=GANESH%EMP& 6 AR #O & RUN& ODS PD* CLOSE&

SAS<9ra,h
4 =e#tives: 1A. 2roduce high resolution bar and pie charts. #/. -ontrol the statistics displayed in the chart. -he 9#hart ,ro#e1ure: Synta2: 2roc 1chart data M SAS ; data ; setI 3$ar chart ; variable TTTTTT..PoptionsQI Cbar chart ; variable TTTTTTTPoptionsQI 2ie chart ; variable TTTTTTTTPoptionsQI Bonut chart ; varible TTTTTTT.. PoptionsQI (unI
5" 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

1/ 9he chart variable determines the no of bars or slices 2roduced with a graph. #/ -hart variable can be numeric or character. 32: 1 2roduce a vertical bar chart that displays the no of employees in each job 9ype. 2roc 1chart data M (aja.empI Cbar jobI (unI 32: 2 produce a horizantal bar chart that displays the no of employees in each job 9ype. 2roc 1chart data M (aja.empI 3bar jobI (unI 32: 3 2roduce a pie chart that displays the no of employees in each job type. 2roc 1chart data M (aja. 0mpI 2ie jobI (unI 7ote: Nob is the chart variable. 7umeri# #hart varia !e: produce a vertical bar chart on the numeric variable Salary. 07A 2roc 1chart data M (aja. 0mpI Cbar salI (unI )is#rete o,tion: 9o override the default behavior for numeric chart variables, 6se the discrete option in the 3bar, Cbar or 2ie Statement. 9he discrete option produces a bar F slice for each 6ni+ue numeric variable value, the values are no longer 9reated as intervals.
Page102

32: 2roduce a vertical $ar chart that displays a separate $ar for each distinct Calue of the numeric variable salary.
51 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

2roc 1chart data M (aja.empI Cbar Sal F BiscreteI (unI

Sumvar an1 ty,e o,tions:


1/ Sumvar identifies the analysis variable to use for the sum or mean -alculation. #/ 9ype specifies the height or length of the $ar or size of the slice represents A means or sum of the analysis variable values. 4/ Lf an analysis variable is specified, the default value of type is sum. !/ Lf not specified, the default value of type is fre+uency. 32: produce a vertical $ar chart that displays the average salary of employees in 0ach job type. 2roc 1chart data M (aja.empI Cbar job F sumvar M Sal type M meanI (unI 32A 2roc 1chart data M (aja. 0mpI Cbar job F sumvar M Sal I (unI 8un 'rou, ,ro#essin': 2roc 1chart support run group processing which means. 1/ 9he procedure e7ecutes the group of statements following the proc statement Jhen a run statement is encountered. #/ Additional statements followed by another run statement can be submitted Jithout resubmitting the proc statement 4/ 9he procedure stays active until a proc, data, or +uit statement is 0ncountered 32: 2roc 1chart data M (aja. 0mpI Cbar jobI 2ie jobI Bonut jobI 3bar jobI (unI 8uitI 32: 2roduce a pie chart that displays the total salary of employees in the each Nob type. 2roc 1chart data M (aja.empI
5# 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

2ie job F sumvar M Sal type M sumI =ormat Sal Bollar1".I (unI Fi!! o,tion: 6se the fill option to specify whether to fill the pie slices in a Solid .fillMS/ or cross hatched .fillMU/ pattern. 32: 2roc 1chart data M (aja. 0mpI 2ie job F sumvar M Sal fill M 7 I =ormat Sal Bollar1".I (unI 32,!o1in' a %ie S!i#eA Oou can highlight individual slices of a 2ie chart by matching them away from the rest of the pie with the 07plode option. 32: 2roc 1chart data M (aja.empI 2ie jobFsumvar M sal type Msum e7plode M GAnalystHI =ormat sal dollar1".I (unI

A11in' tit!es an1 footnotes: 6se the title and footnote statement options to modify the characterstics of te7t strings by using the following options. 1/ -olor M name .or/ cM name #/ =ont M name .or/ fM name 4/ 3eight M n .or/ hMn 32: 1. 9itle f M $rush - M (ed G0mployee informationHI #. 9itle fM $rush -M $lue 3M 4 in )$an, 9able*I 4. 9itle fM Buple7 3eight M 4 )0mployee 9able*I !. =ootnote 3M 4cm )2repared $y Dr. (aja*I 5. =ootnote 3M 4pct )2repared $y (avi*I 36A&%.3S
=59C 8C&A5T DATA65ACA.7:=. <AA5 C9A. PI #y !efault no statisticsIP 5@;. =59C 8C&A5T DATA65ACA.7:=. <AA5 D C9A P S&A=76STA5 ;9F5A:7 9@TS>D76F57Q. 54 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

5@;. =59C 8C&A5T DATA65ACA.7:=. &AA5 D C9A P S&A=76STA5 ;9F5A:7. 5@;. =59C 8C&A5T DATA65ACA.7:=. <AA5 D C9A. 5@;. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF =59C 8C&A5T DATA65ACA.7:=. &AA5 C9A P ;9STAT. 5@;. =59C 8C&A5T DATA65ACA.7:=. &AA5 D C9A P ;9STAT. 5@;. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF =59C 8C&A5T DATA65ACA.7:=. <AA5 C9A. &AA5 C9A. =>7 C9A. D9;@T C9A. AL9CO C9A. STA5 C9A. 5@;. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF T>TL7 C6AL@7 &6 F6A5@S& S7:=L9?77 >;F95:AT>9;S. =59C 8C&A5T DATA65ACA.7:=. D9;@T C9A P <AL@76A559B ;9&7AD>;8. 5@;. =59C 8C&A5T DATA65ACA.7:=. <AA5 C9A P 859@=6D7=T;9. 5@;. =59C 8C&A5T DATA65ACA.7:=. <AA5 C9A P S@A859@=6D7=T;9. 5@;. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF =59C 8C&A5T DATA65ACA.7:=. <AA5 C9APB>DT&66. 5@;. =59C 8C&A5T DATA65ACA.7:=. <AA5 SALPD>SC57T7. 5! 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

5@;. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 'O-TIONS RESET;ALL< =59C 8C&A5T DATA65ACA.7:=. <AA5 SALP:>D=9>;TS61000 T9 10000 A? 1000. 5@;. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF TITLE (;3 C;BL,E F;TA(OMA =EM-LOYEE INFO>< PIFont Si*eFColorFFont ;ame 5esp.IP =ATT75;1 C657D. =ATT75;2 C6ALACO. =ATT75; C68577;. =ATT75;1 C6?7LL9B. =ATT75;2 C6AQ@A. =59C 8C&A5T DATA65ACA.7:=. =>7 C9AP ;9&7AD>;8 <AL@76A559B =75C7;T6>;S>D7. 5@;. 89=T>9;S 57S7T6ALL. =59C 8C&A5T DATA65ACA.7:=. =>7 C9AP7N=L9D76M=57S>D7;TM <AL@76A559B. 5@;. =59C 8C&A5T DATA65ACA.7:=. =>7 C9AP7N=L9D76M=57S>D7;TM <AL@76A559B F>LL6N. 5@;. =59C 8C&A5T DATA65ACA.7:=. =>7 C9AP7N=L9D76M=57S>D7;TM <AL@76A559B F>LL6?. 5@;. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF =ATT75; C6AL@7. =59C 8C&A5T DATA65ACA.7:=. <AA5 C9A. 5@;. =ATT75; <651 C657D. =59C 8C&A5T DATA65ACA.7:=. <AA5 C9A. 5@;. Page102 =ATT75; <652 C657D. PI<652 Less Space #et$een LinesIP =59C 8C&A5T DATA65ACA.7:=. <AA5 C9A. 55 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

5@;. =ATT75; <6L2 C657D. =59C 8C&A5T DATA65ACA.7:=. <AA5 C9A. 5@;. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -ROC FORMAT . <AL@7 AAC 276MSAL7SM 276M57SA5C&M 376M&5M. 89=T>9;S 57S7T6ALL. -ROC 'C(ART DATA65ACA.7:=. <AA5 C9A P 859@=6D7=T;9. F95:AT D7=T;9 AAC.. R,N. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -ROC 'C(ART DATA65ACA.7:=. <AA5 C9A P S@:<A56SAL T?=76S@: CF5A:76AL@7 CT7NT6T7AL. R,N. PI S@:<A5 Summary <aria#le IP -ROC 'C(ART DATA65ACA.7:=. <AA5 C9A P S@:<A56SAL T?=76:7A; CT7NT6T7AL C9@TL>;76AL@7 B9@TL>;763. R,N. -ROC 'C(ART DATA65ACA.7:=. =>7 C9A P ;9&7AD>;8 A;8L7625 CT7NT6AL@7 D7SC7;D>;8 CL9COB>S7 SL>C76A559B. PI Slice ,or- <alue IP R,N.

FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
%84)*/+79 %.4-S 6se the 1plot procedure to plot one variable against another in a Set of coordinate a7is. 2roc 1plot data M SAS ; data ; set I 2lot Cvarible S 3variable PoptionsQI
5 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

Synta2:

(unI 9he Cvariable specifies the vertically a7is variable. 9he 3variable specifies the horizantal a7is variable.

Sym o! statementA use the symbol statement to


1. Befine plotting symbols. #. Braw lines though the data points. 4. Specify the color of the plotting symbols and lines. Oou can specify the plotting symbol you want with the value option in the symbol statement. Synta2: symbol vMname

Se!e#te1 sym o! va!ues: 1. #. 4. !. 5. . 7. 2lus .Befault/ Star Biamond 9riangle S+uare Bot :one .:o plotting symbol/

Je can use the LMoption in the symbol statement to draw lines between the data points .L means interpolation/. Se!e#te1 inter,o!ation va!ues: 1. #. 4. !. 5. Noin. Spline. :eedle. Sms Sm 36A&%.3S
Page102

TITLE H=3 C= L"E *= R"SH 'SALES REPORT'&


57 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

PROC 'PLOT DATA=RA#A%SALES& PLOT SALES*$EAR& S$M OL 6=DOT C= L"E I=#OIN& RUN& TITLE H=3 C= L"E *= R"SH 'SALES REPORT'& PROC 'PLOT DATA=RA#A%SALES& PLOT SALES*$EAR& S$M OL 6=DOT C= L"E I=SPLINE& RUN& TITLE H=3 C= L"E *= R"SH 'SALES REPORT'& PROC 'PLOT DATA=RA#A%SALES& PLOT SALES*$EAR& S$M OL 6=STAR C=RED I=NEEDLE& RUN& /0 MULTI PLOTS 0/ TITLE H=3 C= L"E *= R"SH 'SALES REPORT'& ARIS, LA EL=((AD; G> CA%() 9=PC:8& PROC 'PLOT DATA=RA#A%SALES& PLOT SALES*$EAR PRO*IT*$EAR/O6ERLA$ LEGEND @B7G<=B7G<,& S$M OL, 6=DOT C= L"E I=SPLINE& S$M OL0 6=STAR C=RED I=SPLINE& RUN&

SAS < S-A1/. %ro# univariate: 2roduces statistics describing the distribution of a single variable. 9hese statistics include the mean, median, mode, standard Beviation, s,ewness and ,urtosis. 6sing proc univariate is fairly simple.after the 2roc statement, you specify one or more numeric variable in a Car statement. "ar varia !e C !ist5 8un5 5> 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

Synta2: %ro# univariate 1ata BSAS C )ata C set5

32: 9he following data from a fictions statistics class contain just one variable, test ScoreA 56 D6 D7 7D 67 73 D4 9E 1EE 73 D4 54 9E 74 D1 44 64 7D 76 73 69 D7 7D 64 92 69 73 75 56 65

9he program below reads the raw data from a file called scores.t7t and then runs proc univariate 32A Bata raja. -lassI Lnfile )cAFscores.t7t*I Lnput scoreVVI (unI 2roc univariate dataM raja. -lassI Car scoreI (unI

4*-%*-:
1. 7 C 7o of o servation.

2. &ean C arithmeti# mean. 3. St11ev C stan1ar1 1ivision. 4. S$e0 ness C measures ho0 symF metri# the 1istri ution isF 0hether it is &ore s,rea1ont on one si1e than the other. 5. Gurtosis C &easures ho0 f!at or ,ea$e1 the 1istri ution is. 6. &a2 C ma2imumF hi'hest va!ue in the 1ata set. 7. &e1 C me1ianF the va!ue ha!!0ay <0 the ma2imum H minimum. D. &in C minimumF !o0est va!ue in the 1ata set. 9. &o1e C most freIuent!y o##urrin' va!ue. 2A. %ro# 8e'ression: 9he (egression procedure has only # re+uired statements. Lt must Start with the proc (eg statement and have a model statement Specifying the analysis model. Synta2: %ro# 8e' 1ataB SAS C )ata C set5 &o1e! 1e,en1ent B in1e,en1ent5 8un5 Ln the model statement, the dependent variable is listed on the left side of GMH sign and the independent or regressor variable on the right. 9he plot statement is one of the many optional statements in the reg procedure. 59 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

Synta2A 2lot y variable S 7 variable I 32: At your young neighbors 9 ; ball game, he said to you, you can tell how far they will hit the ball by how tall they are. )9o give him a little practical lesson in statistics you decide to test his hypothesis. Oou gather data from 4" players, measuring their height in inches and their longest of 4 hits in feet. 5E 5E 47 5E 45 32A Bata raja. 3itsI Lnfile )cAW baseball.t7t*I Lnput height distanceVVI (unI 2roc reg dataM raja. hitsI Dodel distanceM hightI 2lot distance S hight I Symbol vMdot cMblueI 9itle )(esults of regression analysis*I (unI 3A. %ro# #orre!ation: A correlation coefficient measure the relationship between two Cariables or how correlated they are. Synta2A proc corr data M SAS ; data ; setI Car variable ; listI Jith variable ; listI (unI 11E 143 136 11D 121 49 49 51 52 4D 13E 135 126 144 135 53 46 4D 45 47 142 132 129 1E7 124 47 46 51 53 53 129 122 144 15E 146 5E 45 47 5E 4D 133 126 119 132 124 5E 5E 4D 51 5E 154 12D 11D 131 131

Oou can use the var and with statements to tell SAS which variables to use. Page102 32A =or each student in a ficititions statistics class, there are 4 variables. 9est score, the :o of hours spent studying the statistics in the wee, prior to the test and the no.of " 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

hours spent e7ercising during the same wee,. 56 44 D5 64 D7 7D 7D 76 67 73 73 69 D4 D7 9E 32: 6 2 7 4 D 5 7 5 5 D D 4 5 6 5 2 E 1 1 4 2 4 1 1 5 3 1 5 3 5 7D 1EE 64 73 92 D4 69 54 73 9E 75 74 56 D1 65 5 5 7 4 6 6 6 D 7 6 D 5 4 5 4 2 6 1 2 7 5 1 E 3 4 3 2 1 4 4

4ut,ut: 1 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

)ata ra=a. /!ass5 +nfi!e J#:<stu1y.t2tK5 +n,ut s#ore stu1y e2er#ise5 8un5 %ro# #orr 1ata B ra=a. /!ass5 "ar stu1y e2er#ise5 With s#ore5 -it!e J#orre!ation for te2t s#oresK5 -it!e2 J0ith hours of stu1yin' an1 e2er#iseK5 8un5

1. : ; :o of observations ; # #. Dean ; Arithmetic mean 4. Std ; Standard deviation. !. Sum ; Sum of all values. 5. Din ; %owest value. . Da7 ; 3ighest value. 7. -orrelation ; correlation coefficient. 4A. %ro# anovaA Anova means analysis of variants.2roc anova can handle multiple -lassification variables and models that include nested and crossed 0ffects as well as repeated measures. 9he anova procedure has # (e+uired statements. 9he class and model statements. Synta2: %ro# anova 1ata B SAS C 1ata C set5 /!ass varia !e C !ist5 &o1e! 1e,en1ent B in1e,en1ent5 8un5

9he class statement must come before the model statements and define the classification variable for one ; way analysis of variants, only one variable is listed. 9he model statements define the dependent variable and the effects. 9here are many optional statements for proc anova, one of the most useful is the mean statement, which calculates Deans of the dependent variable for any of the mean effects in the model statement. Ln addition, the mean statement can perform several types of multiple comparison tests including 9 ; test, Buncan multiple range test .duncan/, scheffes multiple comparison procedure .scheffe/, pair wise 9 ; test and tu,eyHs studentised range test .tu,ey/.

Synta2: means effects F optionsI 9he effects can be any of the mean effect in the model statement. 32: Oour friend says his daughter.=rom (ed 9eam/ complains that it seems li,e the girlHs height 3ypothesis by getting the heights for all the girls and performing analysis of variants # 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102 En all the other softball teams are taller than her team. Oou decide to test her

9o see if there are any differences among teams. Oou have the team name and girls 3eight for player on five different teams. :otice that they are data for si7 girls on 0ach line.

8e1 55 8e1 45 :!ue 46 :!ue 49 9rey 55 9rey 4D %in$ 53 %in$ 59 9o!1 53 9o!1 55

8e1 4D 8e1 46 :!ue 56 :!ue 51 9rey 45 9rey 53 %in$ 53 %in$ 57 9o!1 55 9o!1 46

8e1 53 8e1 55 :!ue 4D :!ue 45 9rey 47 9rey 51 %in$ 5D %in$ 49 9o!1 4D 9o!1 47

8e1 47 8e1 54 :!ue 47 :!ue 4D 9rey 56 9rey 52 %in$ 56 %in$ 55 9o!1 45 9o!1 53

8e1 51 8e1 45 :!ue 54 :!ue 55 9rey 49 9rey 4D %in$ 5E %in$ 56 9o!1 47 9o!1 51

8e1 43 8e1 52 :!ue 52 :!ue 47 9rey 53 9rey 47 %in$ 55 %in$ 57 9o!1 56 9o!1 5E

$ecause each team has e7actly 1# 1irls, the data are balanced and you can use the anova procedure. you want to ,now which, if any, teams are taller than the rest, so you use the means statement in your program and choose scheffeHs multiple comparison procedure to compare the means. 9he following is the program to read the data and perform the analysis of variants.

4 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

32A )ata ra=a. Soft a!!5 +nfi!e J#:<soft a!!.t2tK5 +n,ut teamL hei'htMM5 8un5 %ro# anova 1ata B ra=a. Soft a!! /!ass team5 &o1e! hei'ht B team5 &eans team < s#heffe5

-it!e J'ir!s hei'hts on soft a!! teamK5 8un5

SAS < SN.


2roc S8% is essentially a data base %anguage as opposed to a procedural or computational language. Enly # data types are available in the SAS systems implementation of S8%.:umerous e7tensions, including operators, functions and predicates are available to 2(E- S8% programmers.

)ata -y,es: > Ln the SAS implementation of S8%, there are two available data types.
1. :umeric #. -haracter

SN. Gey0or1s: > S8% 2rovides 9hree Key words.


1. As #. Bistinct 4. 6ni+ue

4,erators : > 9here are several types of operators and functions in SAS S8%.
1. #. 4. !. -omparison operators. %ogical operators. Arithmetic operators. -haracter operators.

1. -omparison operators A' . M, X M, Q M, P M, Q, P / #. %ogical operatorsA ' %ogical operators are used to connect # or more e7pression. . A:B, :E9, E( / 4. Arithmetic operatorsA' . ?, ', F, S, SS.2ower// !. -haracter, string operatorsA ' -oncatenation operators .YY/, length function, upper and lower function.

Summary Fun#tions:>
Page102
1. #. 4. !.

Avg Dean -ount :

! 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

5. . 7. >. 9. 1".

Da7 Din (ange Std Sum Car

%re1i#ates: > 2redicates are used in proc S8% to perform direct comparison between #
-onditions or e7pressions. 1. #. 4. !. 5. . 32: 1 %ro# SI!5 Se!e#t O from 4ra#!e.em,5 Nuit5 32: 2 %ro# SI!5 Se!e#t em,noF =o F sa! from ora#!e.em,5 Nuit5 32: 3 %ro# SI!5 Se!e#t O from ora#!e.em, 0here sa! 9- 4EEE5 Nuit5 32: 4 %ro# SI!5 Se!e#t O from ora#!e.em, 0here =o B P/.38GQ5 Nuit5 32: 5 %ro# SI!5 Se!e#t O from ora#!e.em, 0here =o B P/.38GQ or =o B PA7A.;S-Q5 Nuit5 32: 6 %ro# SI!5 Se!e#t O from ora#!e.em, 0here =o B P/.38GQ an1 Sa! @ 2EEE5 Nuit5 32: 7 Page102 %ro# SI!5 Se!e#t O from ora#!e.em, 0here =o not in RP/.38GQF PSA.3S&A7QA5 Nuit5 5 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! $etween Ln Ls null Ls missing %i,e 07ists

32: D %ro# SI!5 Se!e#t O from ora#!e.em, 0here ename !i$e PSSQ5 Nuit5 32: 9 %ro# SI!5 Se!e#t O from ora#!e.em, 0here ename !i$e PSSQ5 Nuit5 32: 1E %ro# SI!5 Se!e#t O from ora#!e.em, 0here 12O sa! @ 4DEEE5 Nuit5 32: 11 %ro# SI!5 Se!e#t O from ora#!e.em, 0here #omm is nu!!5 Nuit5 32: 12 %ro# SI!5 Se!e#t O from ora#!e.em, 0here #omm is not nu!!5 Nuit5

Summary Fun#tions:>
32: 1 %ro# SI!5 Se!e#t min Rsa!A as minTsa! from ora#!e.em,5 Nuit5 32: 2 PROC S;L& SELECT MIN(SAL) AS MINKSAL,MAR(SAL) AS MARKSAL, S"M(SAL) AS S"MKSAL,A6G(SAL) AS MEANKSAL *ROM GANESH%EMP& ;UIT& 32: 3 %ro# SI!5 Se!e#t #ount R#ommA as #ountT#omm from 'anesh.em,5 Nuit5

Formattin' out,ut:>
Page102 1. Jriting a blan, row between each row. 32:1 %ro# sI! 1ou !e5 Se!e#t O from ora#!e.em,5 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Nuit5 #. 8o0 7um ers:> Je can specify an s+l procedure option called number to display row number on output under the column heading row. 32: 1 %ro# sI! num er5 Se!e#t O from ora#!e.em,5 Nuit5

3. 4r1erin' out,ut re#or1s y #o!umns. 32: 1 %ro# sI!5 Se!e#t O from ra=a.em, or1er y =o 5 Nuit5

32: 2 %ro# sI!5 Se!e#t O from ra=a.em, or1er y ename5 Nuit5 32: 3 %ro# sI!5 Se!e#t O from ra=a.em, or1er y sa!5 Nuit5 32: 4 %ro# sI!5 Se!e#t O from ra=a.em, or1er y sa! 1es#5 Nuit5

9rou, y #!ause:> Jhen a group by clause is used with a summary function the
rows are aggregated in a series of groups. 32: 1 %ro# sI!5 Se!e#t =o F sum Rsa!A as tota!Tsa! from ora#!e.em, 'rou, y =o 5 Nuit5

32: 2 %ro# sI!5 Se!e#t =o F #ount R=o A as nF min Rsa!A as minimumF ma2 Rsa!A as ma2imum from ora#!e.em, 'rou, y =o 5 Nuit5

Havin' /!ause:>
Page102 %ro# SI!5 Se!e#t =o F sum Rsa!A as tota!Tsa! from ora#!e.em, 'rou, y =o havin' sum Rsa!A 't 12EEE5 Nuit5 7 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

/ase 32,ression:>

>>>>>>O>>>>>>> Ln S+l procedure, a case e7pression provides a way of

determining what the resulting value from all rows in a table .similar to a data step select statement, a case e7pression is based on some condition. Synta2: /ase ?#o!umn name@ When #on1ition then resu!t>1 When #on1ition then resu!t>2 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 3!se resu!t>n5 3n15 32:> 1 %ro# sI!5 Se!e#t em,noF enameF =o F /ase When =o BQ&A7A938Q then P98A)3>1Q When =o BQ/.38GQ then P98A)3>2Q When =o BQA7A.;S-Q then P98A)3>3Q 3!se P7AQ 3n1 as 8an$ from 9anesh.em,5 Nuit5

/reatin' a -a !e:> Ence the table design process is complete each table is then ready
to be created with the create table statement. 9he purpose of creating table is to create an object that does not already e7ist. Ln the SAS implementation three variations of the create table statement can be specified depending on your needs. 1. /reatin' a ta !e stru#ture 0ith the !i$e #!ause. 2. )erivin' a ta !e stru#ture an1 1ata from an e2istin' ta !e. 3. /reatin' a ta !e stru#ture 0ith #o!umn 1efinition !ists.

1./reatin' a ta !e usin' !i$e #!ause:> 9he %i,e clause triggers the e7isting tables
structure to be copied to the new table minus any columns dropped with the ,eep or drop dataset option. Lt copies the columns and attributes from the e7isting table structure to the new table structure .using this method, results in the creation of an empty table. Page102

> 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

32: 1

%ro# sI!5 /reate ta !e ra=a.em, !i$e ora#!e.em,5 Nuit5

32: 2 %ro# sI!5 /reate ta !e ra=a.em, R1ro,B#ommA !i$e ora#!e.em,5 Nuit5 32: 3 %ro# sI!5 /reate ta !e ra=a.em, R$ee,B=o sa!A !i$e ora#!e.em,5 Nuit5

2.)erivin' a -a !e an1 1ata from e2istin' ta !e:>


32: 1 %ro# sI!5 /reate ta !e ra=a.em, as se!e#t O from ora#!e.em, 5 Nuit5

32: 2 %ro# sI!5 /reate ta !e ra=a.em, R1ro,B#omm 1e,tnoA as se!e#t O from ora#!e.em,5 Nuit5

/reate ne0 #o!umns:>


32: %ro# sI!5 /reate ta !e ra=a. an$ Ra##no num R5AF name #har R2EAF a! num R15AF t1ate num informatB1ate7. FormatB1ate7.A5 Nuit5

%o,u!atin' -a !es:> 9he S+l standard provides the insert into statement as the
vehicle for adding the rows of data. 32: %ro# sI!5 +nsert into ra=a. an$ va!ues R1E1FQra=uQF4EEEFQ12=anE9Q)A "a!ues R1E2FQramuQF5EEEF14fe EDQ )A5 Nuit5

)e!etin' ro0s in a ta !e:> 9he Belete statement and an option where clause can
remove one or more unwanted rows from a table. &etho1s:> 1. )e!etin' a sin'!e ro0. 9 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

2. )e!etin' more than one ro0. 3. )e!etin' a!! ro0s in a ta !e. 32: 1 %ro# sI!5 )e!ete from ra=a. an$ 0here a##noB1E15 Nuit5 %ro# sI!5 )e!ete from ra=a. an$ 0here a!@5EEE5 Nuit5 %ro# SI!5 )e!ete from ra=a. an$5 Nuit5

32: 2

32: 3

)ro, -a !es:> 9he s+l standard permits us one or more unwanted tables to be
removed from a database RSAS !i raryA. 32: 1 )ro,,in' a sin'!e ta !e: %ro# sI!5 )ro, ta !e ra=a. an$5 Nuit5 32: 2 )ro,,in' mu!ti,!e ta !es %ro# sI!5 )ro, ta !e ra=a. an$ ra=a.em,5 Nuit5

&o1ifyin' a ta !e:> After a table is defined and populated with data , a column as
well as its structure may need modifying.

Synta2:
2roc s+lI Alter table tableZname AddFmodifyFdrop -olumn specificationsI 8uitI A11in' a ne0 #o!umn: Page102

7" 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

32:

%ro# sI!5 A!ter -a !e ra=a. an$ a11 a'e num R3A5 Nuit5

/han'in' a #o!umn !en'th: -olumn definitions can be modified with the modify clause in the alter table statement. 2roc s+l enables a character or numeric column length have to changed. 32: %ro# sI!5 A!ter ta !e ra=a. an$ mo1ify name #har R25A5 Nuit5

)ro,in' an e2istin' #o!umn: 32: %ro# sI!5 A!ter ta !e ra=.em, 1ro, #o!umn sa! F #omm.5 Nuit5

UPDATE STATEMENT SYNTAX: PROC S;L& "PDATE TA LE-NAME SET COL"MN=ERPRESSION WHERE CONDITION& ;UIT&
36A&%.3:

PROC S;L& "PDATE RA#A%EMP SET *NAME=(DE6ID( WHERE EMPNO=7788& ;UIT&

Uoins:> Noining two or more tables of data is a powerful feature in relational model. 9he
s+l procedure enables you to join tables of information +uic,ly and easily. 71 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

3Iui=oin:> 9he most common form of innerjoin often referred to as an e+ui join uses an e+ual sign.GMH/ in the where clause to indicate e+uality between the columns in two or more tables. 32: %ro# sI!5 Se!e#t em,.em,noF em,.enameF em,.=o F em,.sa!F em,.1e,tnoF 1e,t.1nameF 1e,t.!o# from ora#!e.em,F ora#!e.1e,t Where em,.1e,tnoB1e,t.1e,tno5 Nuit5

"ie0s: > Ciews are one of the more powerful features available in the s+l procedures.
9hey are commonly referred to as virtual tables. 9o distinguish them from base tables, the simple difference is that views are not tables but files consisting of e7ecutable instructions. A view does not store any data.

-y,es of "ie0s: 1. Simple view #. -omple7 view Sim,!e "ie0: A view is created by using only one table is called simple view 32: %ro# sI!5 /reate vie0 ra=a.em,Tv as se!e#t em,.em,noF em,.=o F em,.sa! From ora#!e.em,5 Nuit5

/om,!e2 "ie0: A view is based on two or more tables. 32: %ro# sI!5 /reate vie0 em,T1e,t as Se!e#t em,.em,noF em,.enameF em,.=o F em,.sa!F em,.1e,tnoF 1e,t.1nameF 1e,t.!o# From ora#!e.em,F ora#!e.1e,t 0here em,.1e,tnoB1e,t.1e,tno5 Nuit5

7# 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

-o #a!! a vie0: %ro# sI!5 Se!e#t O from ra=a.em,>1e,t5 Nuit5

48A/.3 SN. /47/3%-S


1. Structured +uerry language is a language used by most relational database Systems. #. 9he S8% was developed by L$D in the middle of 197". 4. Ln 1979, Eracle -orporation introduced the first commercially available Lmplementation of S8%.

Features of SN.:
1. Lt is an 0nglish li,e language. #. :on'procedural language. .:on procedural means what rather than how[/ 4. Lt is used by B$AHs, end users, application programmers, management personnel. !. Lt processes a set of records rather than a single record at a time.

-a !e: 9he systematical arrangement of rows and columns is called 9able. 9he
3orizontal lines are called rows and vertical lines are called columns.

8e#or1: collection of various fields. )ata ase: A database is a logically related information of data or collection of
(ecords.

Se!e#t #omman1: 9he select statement retrieves information from the database,
Lmplementing all the operators of relational algebra. Synta2: S8% Q select column1, column#, column4TT.,-olumn'n from table nameI 4,erators in SN.: 1. Arithmetic operatorsA ?,', S, F #. %ogical operatorA A:B, E(, :E9 4. -omparison operatorA Q, P, QM, Y M, between, li,e, is null, in, any, all. 74 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

4r1er y #!ause: 9he order by clause is used to sort the table rows. 9his clause must
Always be the last clause in the select statement.

9rou, y #!ause: 9his clause groups the selected rows and summarizes them based
on the value of the e7pression so that only a single row is returned for each row.

Havin' #!ause: (estricts the groups of rows returned to those group for which the
Specified condition is true.

/reate ta !e #omman1: 9he create table command creates a table to hold the user
Bata. Synta2: #reate ta !e ta !e>name R#o!umn1 1ata ty,eF #o!umn2 1ata ty,eVVVVF #o!umn>n 1ata ty,eA5

*,1ate #omman1: 9he update command is used to change the e7isting data values in
A table. Lt consists of an update clause followed by a set clause and An option where clause. Synta2: u,1ate ta !e C name Set /o!umn C 1 B va!ueF /o!umn C 2 B va!ueF >>>>>>>>>>>>>>>>>>>>>>>>>>F >>>>>>>>>>>>>>>>>>>>>>>>>>>F WWhere #!auseX5

Yo,tiona!
)e!ete #omman1: 9his command remove specified rows from a table.
Synta2: SN. @ )e!ete from ta !e C name W0here #!auseX5

8o!! a#$: 9o undo wor, done in the current transaction upto the previous commit. A!ter ta !e #omman1: 9he alter table command is used to modify an e7isting
-olumn definition or add a new column. Page102 Synta2: SN. @ A!ter ta !e ta !e C name A11 < mo1ify /o!umn s,e#ifi#ations5 7! 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

8enamin' a ta !e:
Synta2: SN. @ 8ename o!1 name to ne0 C name5

-run#atin' a ta !e: 9runcate command removes all the rows from a table
2ermanently. Synta2: -run#ate ta !e ta !e C name5

)ro, #omman1: 9his command deletes all the rows in the table along with the table .
Enly one table can be dropped using this command at a time. Synta2: 1ro, ta !e ta !e>name5 8o0 7um: =or each row retrieved by a +uarry, the (ow :um returns a number Lndicating the order in which oracle selects the rows from a table. EXERCISE S8%Q S0%0-9S=(ED 9A$I S8%Q S0%0-9S=(ED 0D2I S8%Q S0%0-9 0D2:E,0:AD0,NE$,SA% =(ED 0D2I S8%Q S0%0-9S=(ED 0D2 J30(0 -EDD LS :6%%I S8%Q S0%0-9S=(ED 0D2 J30(0 -EDD LS :E9 :6%%I S8%Q S0%0-9S=(ED 0D2 J30(0 0:AD0 %LK0 \S]\I S8%Q S0%0-9S=(ED 0D2 J30(0 NE$M\-%0(K\I S8%Q S0%0-9S=(ED 0D2 J30(0 NE$M\-%0(K\ E( NE$M\A:A%OS9\I S8%Q S0%0-9S=(ED 0D2 J30(0 NE$ L: .\SA%0SDA:\, \DA:A10(\/I S8%Q S0%0-9S=(ED 0D2 J30(0 SA% $09J00: #""" A:B 4"""I S8%Q S0%0-9S=(ED 0D2 E(B0( $O NE$I S8%Q S0%0-9S=(ED 0D2 E(B0( $O NE$ B0S-I 75 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

S8%Q S0%0-9S=(ED 0D2 E(B0( $O SA%I S8%Q S0%0-9S=(ED 0D2 E(B0( $O SA% B0S-I S8%Q S0%0-9 B029:E,DL:.SA%/,DAU.SA%/,S6D.SA%/ =(ED 0D2 1(E62 $O B029:EI S8%Q S0%0-9 NE$,DL:.SA%/,DAU.SA%/,S6D.SA%/ =(ED 0D2 1(E62 $O NE$I S8%Q S0%0-9 NE$,DL:.SA%/,DAU.SA%/,S6D.SA%/ =(ED 0D2 1(E62 $O NE$ 3ACL:1 DL:.SA%/ Q1"""I S8%Q -(0A90 9A$%0 S96B0:9.(E%%:E :6D$0(.4/,:AD0 -3A(.1#/,A10 :6D$0(.#//I S8%Q L:S0(9 L:9E S96B0:9 CA%60S.1"",\S-E99\,#4/I S8%Q L:S0(9 L:9E S96B0:9 CA%60S.1"1,\JA(B\,#!/I S8%Q -(0A90 9A$%0 DO0D2 AS S0%0-9S=(ED 0D2I S8%Q B0%090 =(ED DO0D2 J30(0 0D2:EM77>>I S8%Q B0%090 =(ED DO0D2 J30(0 NE$M\SA%0SDA:\I S8%Q B0%090 =(ED DO0D2I S8%Q (E%%$A-KI S8%Q S0%0-9S=(ED DO0D2I S8%Q B(E2 9A$%0 S96B0:9I S8%Q A%90( 9A$%0 DO0D2 B(E2 -E%6D: D1(I S8%Q A%90( 9A$%0 DO0D2 ABB =:AD0 -3A(.1#/I S8%Q 9(6:-A90 9A$%0 DO0D2I S8%Q 62BA90 0D2 S09 SA%MSA%?SA%S1"F1"" J30(0 NE$M\SA%0SDA:\I S8%Q 62BA90 0D2 S09 SA%MSA%?SA%S15F1""I Page102 S8%Q 0UL9I

2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

SAS C A//3SS
9he SAS access products allow access to data in popular B$DS system li,e oracle. you -an access files directly without conversion or even copying this means that data can be stored and 6pdated in one location, ensuring that you can using the most current data for analysis.

+m,ortin' 1ata from other sour#es:


Ln SAS data can access from number of Sources. 1. )ata ase mana'ement system !i$e ora#!e. 2. S,rea1 sheets !i$e 32#e!. 3. 4ther statisti#a! ana!ysis ,ro'rams !i$e S,ss.

S-S S DBase

DB2 EXCEL DATA DATA SYBASE

ORACLE

INFORMIX
Page102

77 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

+m,ortin' 1ata form 4ra#!e 1ata ase -here are t0o asi# metho1s for rea1in' 1ata from ora#!e ta !es.

1. 6sing the oracle engine on libname statement. 9his is a variation on the usual use of SAS libraries. -all this method )%ibname oracle*. #. 6sing )S8% pass through* to connect directly to the oracle instance. .i name 4ra#!e: 9he libname oracle methods of accessing oracle tables is straight =orward and may be used in all most all circumstances. Ln this method oracle, not SAS, processes the S8% statements and returns the results to your SAS session. Synta7A %ibname libraryZref oracle userM*oracle'user'name* passwordM*oracle'password*I 36: .+:8A8; 8AU3SH 48A/.3 *S38BQS/4--Q %ASSW48)BQ-+938Q5 SN. %ass throu'h: 2roc s+lI -onnect to oracle .userMname passwordMoracle'password/I S+l statementsI Bisconnect from oracleI 8uitI %84/ ):.4A): R36%48-A 9he Bbload procedure wor,s in the opposite direction. Lt is used to copy data into a dbms from a SAS dataset. 9his procedure is useful for $ul, loads. Features: 1. 9he default load limit is 5""" records. Ln order to load larger tables specify limitM". #. 9he proc will abend if table e7ist. Lt can only used to create new tables. Synta2: 7> 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

2roc dbload dbmsMname dataMsas'data'setI 6serM*userZname*I 2wM*pass word*I 9ableM*new'table'name*I %imitM"I %oadI (unI

P:-+ <=>-!< LPD<=ORACLE LB;B=GANESH%EMP& "<8A='SCOTT'& PH='TIGER'& TBPC8='EMP'& LGDG;=0& L=BL& R*$&

E1a&ple0

P:-+ <=>-!< LPD<=ERCEL LB;B=EB>8<I%8DF& PATH='C:QDINESH%RLS'& P"TNAMES=$ES& DELETE HIREDATE MGR& L=BL& R*$&
E1a&ple0

PROC S;L& CONNECT TO ACCESS(PATH='C:QGANESH%MD ')& CREATE TA LE GANESH%M$EMP AS SELECT**ROM CONNECTION TO ACCESS(SELECT**ROM EMP)& DISCONNECT *ROM ACCESS& ;UIT&
E1a&ple0

PROC S;L& CONNECT TO ORACLE("SER=SCOTT PASSWORD=TIGER)& CREATE TA LE GANESH%EMP,01


79 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

AS SELECT**ROM CONNECTION TO ORACLE(SELECT**ROM EMP)& DISCONNECT *ROM ORACLE& ;UIT&


E1a&ple0

PROC S;L& CONNECT TO ORACLE("SER=SCOTT PASSWORD=TIGER)& SELECT**ROM CONNECTION TO ORACLE(SELECT**ROM EMP)& DISCONNECT *ROM ORACLE& ;UIT&
E1a&ple0

PROC S;L& CONNECT TO ACCESS(PATH='C:QGANESH%MD ')& SELECT**ROM CONNECTION TO ACCESS(SELECT**ROM EMP)& DISCONNECT *ROM ACCESS& ;UIT& SYNTAX: PROC EXPORT DATA=SAS-DATA-SET O"TTA LE='TA LE-NAME' D MS=ACCESS REPLACE& DATA ASE='*ILE-PATH'& RUN&
E1a&ple0

/* SAS TO MS-ACCESS */

PROC EXPORT DATA=GANESH%EMP O"TTA LE='M$EMP' D MS=ACCESS REPLACE& DATA ASE='C:QGANESH%MD '& RUN& /* MS-ACCESS ;= SAS */ SYNTAX: PROC IMPORT TA LE='TA LE-NAME' O"T=SAS-DATA-SET D MS=ACCESS REPLACE& DATA ASE='*ILE-NAME'& RUN&
E1a&ple0 >" 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

PROC IMPORT TA LE='EMPLO$EE' O"T=A#A$%EMP D MS=ACCESS REPLACE& DATA ASE='C:QGEETHA%MD '& RUN&

&A/84S
Jhen you submit a standard SAS program, SAS compiles and them immediately e7ecutes it. $ut when we write a SAS macro, there is an additional step. $efore SAS could compile and e7ecute the program, SAS must pass macro statements to the macro processor which )resolves* your macro, generating standard SAS code because you are writing a program, this is sometimes called Deta programming.

Dacro Statements

Dacro processor

Standard SAS Statement

&a#ro H ma#ro varia !es:

9he SAS macro code consists of # basic parts. 1. Dacros. #. Dacro variables. 9he names of macro variables are prefi7ed as an Ampersand .^/ while the name of macros are prefi7ed with a percent .]/ sign. A macro variable is li,e a standard data variable e7cept that, Page102 having only a single value it does not belong to a dataset and its value is always

>1 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

character. 9he value could be a variable name a numeral, or any te7t that you want to get substituted into your programme.

/reatin' a ma#ro:
Dacro is a piece of bug free code and uses it repeatedly within a Single SAS program or many SAS programs. Synta2: ]macro macro'nameI Dacro'te7tI ]Dend macro'nameI 9he ]macro statement tells SAS that this is the beginning of a macro, while ]mend mar,s the end. Dacro'te7t is a set of SAS statements.

+nvo$in' a ma#ro:
]macro'nameI A semicolon is not re+uired when invo,ing a macro.

Synta2:

A11in' ,arameters to ma#ros:


2arameters are macro variables, whose value can Set when invo,e a macro. Synta2: ]macro macro'name .parameter'1M, parameter'#M T.Tparameter'nM/I Dacro'te7tI ]Dend macro'nameI 32: -reate a macro to print all employee details separately job wise without using a by Statement.

/0 E&!#?>".0/ @MACRO SHOW(#,D)& PROC PRINT DATA=TD& WHERE #O ='T#'& TITLE 'T#(S REPORT'& @MEND SHOW& )SHOW(ANAL$ST,GANESH%EMP)&
># 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

)SHOW(CLERK,ORACLE%EMP)& )SHOW(MANAGER,RA6I%EMP)& )SHOW(SALESMAN,GANESH%EMP)& RUN& @MACRO SHOW(6,,60,61,D)& PROC REPORT DATA=TD NOWD& COL"MN T6, T60 T61& @MEND SHOW& )SHOW(EMPNO,ENAME,#O ,GANESH%EMP)& )SHOW(#O ,SAL,COMM,RA6I%EMP)& )SHOW(EMPNO,#O ,SAL,ORACLE%EMP)& RUN& @MACRO SORTING(6,D)& PROC SORT DATA=TD& $ T6& @MEND SORTING& )SORTING(#O ,ORACLE%EMP)& )SORTING(DEPTNO,GANESH%EMP)& RUN&

Writin' ma#ros 0ith /on1itiona! !o'i#:


1. ] if condition ] then actionI ] else ] if condition ] then actionI ] else actionI #. ] if condition ] then ] doI SAS statementsI ] endI

Synta2:

-hese ma#ro statements #an e use1 on!y insi1e a ma#ro. @MACRO SHOW(#)& )I* T#=ANAL$ST )THEN )DO& PROC PRINT DATA=GANESH%EMP&
>4 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

WHERE #O ='T#'& TITLE 'T#(S REPORT'& )END& )ELSE )I* T#=CLERK )THEN )DO& PROC MEANS DATA=GANESH%EMP& WHERE #O ='T#'& TITLE 'T#(S REPORT'& )END& @MEND SHOW& )SHOW(CLERK)& RUN&

Automati# ma#ro varia !es: 0very time you invo,e SAS, the macro processor
automatically creates certain macro variables. Oou can use these variables in your programmes. 9he most common automatic variables are 1/ SOSBAO #/ SOSBA90 4/ SOS9LD0

EXAMPLES @MACRO DAILY_REPORTS& )I* TS$SDA$=M=>LBN );I8> )L=& PROC PRINT DATA=GANESH%EMP& WHERE #O ='ANAL$ST'& TITLE 'TS$SDA$(S REPORT'& )END& )ELSE )I* TS$SDA$=T:8<LBN );I8> )L=& PROC PRINT DATA=GANESH%EMP& WHERE #O ='CLERK'&
>! 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

TITLE 'TS$SDA$(S REPORT'& )END& @MEND DAIL$KREPORTS& )DAILY_REPORTS& RUN& PROC PRINT DATA=GANESH%EMP& TITLE 'REPORT GENERATED ON TS$SDATE'& RUN& PROC PRINT DATA=GANESH%EMP& TITLE 'REPORT GENERATED ON TS$SDA$ B; TS$STIME'& RUN&

7estin' of the ma#ros: A macro within an another macro is called nesting of the
Dacros.

EX: @MACRO ABC& PROC SORT DATA=GANESH%EMP& $ #O & @MEND A C& @MACRO XYZ& )ABC& PROC PRINT DATA=GANESH%EMP& $ #O & @MEND R$V& )XYZ& RUN& EX: @MACRO ABC& PROC SORT DATA=GANESH%EMP& $ #O &
>5 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

@MEND A C& @MACRO XYZ& PROC PRINT DATA=GANESH%EMP& $ #O & @MEND R$V& @MACRO PQR& )ABC& )XYZ& @MEND PQR& )PQR& RUN& EX: @MACRO ABC& PROC SORT DATA=GANESH%EMP& $ #O & @MEND A C& @MACRO XYZ& )ABC& PROC PRINT DATA=GANESH%EMP& $ #O & @MEND R$V& @MACRO PQR& )XYZ& @MEND PQR& )PQR& RUN& 'LO(AL MACRO VARIA(LES A @BAGBPC8 L8CB9A8L G><GL8 B DB9A= L8?G>G;G=> G< M>=H> B< L=9BC DB9A= @BAGBPC8%I; G< >=; F=<<GPC8 ;= B998<< ;I8 C=9BC DB9A= @BAGBPC8< =:; <GL8 ;I8 DB9A= L8?G>G;G=>%
> 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

A @BAGBPC8 G< L8CB9A8L =:;<GL8 B DB9A= L8?G>G;G=> G< M>=H> B< GC=PBC DB9A= @BAGBPC8%$=: 9B> B998<< GC=PBC DB9A= @BAGBPC8< B>N HI8A8 G> ;I8 PA=EABD% S$NTAR: EX: 1 )LET #=SALESMAN& @MACRO ABC& PROC PRINT DATA=GANESH%EMP& WHERE #O ='T#'& TITLE 'T#(S REPORT'& @MEND A C& @MACRO XYZ& PROC MEANS DATA=GANESH%EMP& WHERE #O ='T#'& TITLE 'T#(S REPORT'& @MEND R$V& )ABC& )XYZ& RUN& EX : 2 /0LOCAL MACRO VARIA(LE 0/ )LET GLO AL 6ARIA LE-LIST&

@MACRO ABC& )LET #=SALESMAN& PROC PRINT DATA=GANESH%EMP& WHERE #O ='T#'& TITLE 'T#(S REPORT'& @MEND A C& @MACRO XYZ& PROC MEANS DATA=GANESH%EMP& WHERE #O ='T#'& TITLE 'T#(S REPORT'&
>7 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

@MEND R$V& )ABC& )XYZ& RUN& EX: 3 @MACRO ABC& )GLO AL #& )LET #=SALESMAN& PROC PRINT DATA=GANESH%EMP& WHERE #O ='T#'& TITLE 'T#(S REPORT'& @MEND A C& @MACRO XYZ& PROC MEANS DATA=GANESH%EMP& WHERE #O ='T#'& TITLE 'T#(S REPORT'& @MEND R$V& )ABC& )XYZ& RUN&

32terna! ma#ros: Dacros and other SAS commands can be stored in an e7ternal
=ile which can be included

OPEN T1E NOTEPAD !$< TYPE T1E FOLLOAIN' CODE: @MACRO SORTING(6,D)& PROC SORT DATA=TD& $ T6& PROC PRINT DATA=TD& $ T6& @MEND SORTING&
>> 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

F+.3 SA"3 AS J):ZS48-+79.SASK A7 36-387A. &A/84 +S /83A-3). 36+- F84& 74-3 %A)

USIN' EXTERNAL MACROS )INCL"DE 'D:QSORTING%SAS'& )SORTING(#O ,GANESH%EMP)& RUN&

MACRO FUNCTIONS )LET NAME=A#A$& )LET M$NAME=)LOWCASE(TNAME)& )P"T NAME IS TNAME& )P"T M$NAME IS TM$NAME& EX: @MACRO A C(#)& PROC PRINT DATA=GANESH%EMP& WHERE #O =')"PCASE(T#)'& TITLE 'T#(S REPORT'& @MEND A C& )ABC(<BC8<DB>)& :*$& EX: )C8; )C8; )C8; )C8; B=,-& P=0-& 9=1-& L=)8@BC(TB+TP*T9)&
Page102

)F:; B=TB& )F:; P=TP&


>9 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

)F:; 9=T9& )F:; L=TL& EX: )C8; )C8; )C8; )C8; )F:; )F:; )F:; )F:; B=,-%./& P=0-%10& 9=1-%0,& L=)<N<8@BC?(TB+TP*T9)& B=TB& P=TP& 9=T9& L=TL&

SAS.?are+o se Ad&inistrator@
SASFJarehouse Administrator is designed for the L9 professional responsible for creating and managing data warehouseFdata mart processes. SASFJarehouse Administrator is a customizable solution that offers a single point of control, ma,ing it easier to respond to the ever'changing needs of the business community. 0nd users increasingly understand the benefits of basing business intelligence systems on the solid foundations of a data warehouse. $ut from the L9 department\s perspective, implementing a corporate data warehousing strategy is a commitment of time and resources. 3and'writing programs to perform the tedious chores of e7tracting, cleansing transforming and loading operational data into a repository suitable for business intelligence applications can overe7tend even the most productive L9 departments. SASFJarehouse Administrator software simplifies the setup and management of multiple data warehouses and data marts. 9his single solutionA
>ntegrates eDtraction" transformation an! loa!ing tools for #uil!ing an! managing !ata $arehousesP!ata marts. =ro'i!es a frame$or% for effecti'e $arehouse management through a meta!ataF!ri'en architecture.

9" 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

Facilitates #usiness su#/ect !efinition" consoli!ation of #usiness rules" sche!uling of processes for $arehouse maintenance an! integration $ith !ecisionFsupport tools for effecti'e $arehouse eDploitation.

Le'erages the strengths of SAS soft$are an! rapi! $arehousing to !eli'er the $ellF pro'en #enefits of a !ata $arehouse e'en faster.

SASFJarehouse Administrator software brings together the components in SAS software which are ,ey to setting up and managing a SAS data warehouse R through the three phases of data warehouse management, organization and e7ploitation. 9o meet their business objectives, many organizations are setting up multiple'hierarchy data warehouses and localized data marts. SAS Jarehouse Administrator software greatly reduces the comple7ity of building and managing the data warehouse and helps to automate day'to'day processes. Jith its graphical user interface, you can simplify the visualization, navigation and maintenance of the data warehouse and eliminate much of the coding wor, re+uired to build and manage it. SASFJarehouse Administrator software offers the adaptability and the manageability you need as your business and information needs change, as more data is added, as processes become more comple7, and as users re+uire greater support.
?+at is a Data ?are+o seA A Data Barehouse is a collection of !ata that is eDtracte! from one or more sources for the purpose of (uery an! analysis. For eDample" an apparel company might create a Data Barehouse that integrates sales" supplier" in'entory" an! !emographic !ata from 'arious sources. This collection $oul! help the company analy*e ho$ sales are affecte! #y geography" #y the gen!er an! age of the customer" an! #y other factors.

91 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

(oB does SAS.?are+o se Ad&inistrator Bor#A @sing the $in!o$s in SASPBarehouse A!ministrator" you specify meta!ata that !efines !ata sources" !ata stores" co!e li#raries" an! other $arehouse resources. :eta!ata is a !efinition or !escription of !ata. SASPBarehouse A!ministrator uses t$o types of meta!ata: physical an! #usiness. The physical meta!ata for a ta#le might specify a certain num#er of ro$s an! columns" $ith certain transformations that are applie! to some of the columns. The #usiness meta!ata for a ta#le might !escri#e the purpose of the ta#le an! contact information for the person $ho is responsi#le for the accuracy of the information in the ta#le. SASPBarehouse A!ministrator then uses this meta!ata to generate or retrie'e the co!e that eDtracts" transforms" an! loa!s the !ata into your $arehouse.

9# 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

?+at are t+e ad"anta$es o% &etadataA SASPBarehouse A!ministrator uses the meta!ata that you enter to generate or retrie'e the co!e that creates your !ata $arehouse. This meta!ataF!ri'en approach might seem inefficient $hen compare! to simply $riting a program to perform a specific tas%. &o$e'er" SASPBarehouse A!ministrator offers the follo$ing a!'antages o'er $riting an! managing in!i'i!ual programs: you ha'e a single point of control for managing !ata $arehouse resources #ecause the resources are !efine! in meta!ata. you ha'e a consistent an! !ocumente! flo$ of information across computing platforms. the flo$ of the !ata is !ocumente!" so you can trace information from its source through the entire !ata $arehouse. Documentation also ma%es it easier to analy*e an! impro'e !ata flo$s" resulting in #etter (uality. you can use meta!ata to automate many tas%s. For eDample" if you ha'e entere! the appropriate meta!ata" you can generate the co!e to create an! loa! a !ata store. you can use meta!ata as a S'ie$S on the !ata $arehouse. For eDample" you can eDport the meta!ata for a !ata $arehouse an! ma%e it a'aila#le to #usiness analysts $ho might nee! to ans$er (uestions such as $hat is the origin of the !ata in this report" $hat !oes this column mean" an! ho$ $as it !eri'e!.

?+at ot+er %eat res does SAS.?are+o se Ad&inistrator pro"ideA SASPBarehouse A!ministrator also pro'i!es a =rocess Li#rary that contains routines that can #e inclu!e! in the process flo$s for !ata stores in your $arehouse. For eDample" there are routines that stan!ar!i*e a!!resses. meta!ata eDporters that eDport SASPBarehouse A!ministrator meta!ata to other applications. a meta!ata A=> that ena#les you to $rite client applications that rea! or $rite SASPBarehouse A!ministrator meta!ata. SASPBarehouse A!ministrator tools an! utilities from the SAS Be# site. For eDample" you can use an a!!Fin tool to trace the impact of a change in a $arehouse !ata store.

94 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

SAS.?are+o se Ad&inistrator data %loB Ta%e a loo% at the follo$ing flo$ of information through a !ata $arehouse that is manage! #y SASPBarehouse A!ministrator. information is eDtracte! from !ata sources an! is store! in a ta#le or 'ie$ that is registere! in a Data Barehouse 7n'ironment. The ta#le or 'ie$ is calle! an 9perational Data Definition ,9DD-. the 9DDs are use! as inputs to !ata stores. The !ata stores are organi*e! in the Data Barehouse un!er grouping elements" that are calle! Su#/ects an! Data 8roups. once the !ata stores ha'e #een loa!e!" you can eDploit them using SAS soft$are or other soft$are pro!ucts. For eDample" you coul! use 7nterprise :iner to analy*e patterns in the !ata.

O"er"ieB

9! 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

SASPBarehouse A!ministrator pro'i!es a 'isual en'ironment for #uil!ing an! managing !ata $arehouses. The $in!o$s in SASPBarehouse A!ministrator ena#le you to eDplore a $arehouse" create meta!ata" an! !efine Co#s. Ta%e a #rief tour of the follo$ing main $in!o$s that are in SASPBarehouse A!ministrator. SASPBarehouse A!ministrator Des%top SASPBarehouse A!ministrator 7Dplorer Define >tems @se! 8lo#ally $in!o$ =rocess 7!itor.

T+e SAS.?are+o se Ad&inistrator Des#top

95 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

Bhen you in'o%e SASPBarehouse A!ministrator" the !es%top is !isplaye!. The !efault !es%top inclu!es fol!ers for Data @tilities an! 7Dploitation Tools. The Data ,tilities fol!er contains the SAS utilities that are use! to 'ie$" print" or (uery the contents of $arehouse ta#les. The E1ploitation Tools fol!er contains SAS applications that are use! to eDploit a !ata $arehouse after it is #uilt. The applications that appear in this fol!er $ill 'ary from site to site. >f any Data Barehouse 7n'ironments ha'e #een !efine! for your site" their icons might appear on the SASPBarehouse A!ministrator !es%top. Thin% of a Data Barehouse 7n'ironment as a container for some of the meta!ata that is associate! $ith one or more !ata $arehouses. The Mar#etin$ En" icon in the image #elo$ represents the 7n'ironment that you $ill create in this tutorial.

T+e SAS.?are+o se Ad&inistrator E1plorer The SASPBarehouse A!ministrator 7Dplorer is !isplaye! $hen you open a Data Barehouse 7n'ironment. The SASPBarehouse A!ministrator 7Dplorer is use! to !efine an! #ro$se the meta!ata for a Data Barehouse 7n'ironment. SASPBarehouse A!ministrator uses this meta!ata to generate or retrie'e the co!e that eDtracts" transforms" an! loa!s the !ata into your !ata stores. The left panel of the $in!o$ !isplays the hierarchy of elements in the 7n'ironment. The right panel is use! to !isplay the meta!ata for a selecte! element.

2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

Ele&ents in t+e En"iron&ent +ierarc+) For each !ata $arehousing pro/ect" you $ill create a hierarchy of groups an! !ata stores in the SASPBarehouse A!ministrator 7Dplorer. A group is an element that is use! to organi*e other elements. >n the follo$ing image" the Mar#etin$ En" is the topFle'el group" an! Ca&pai$n ?+se an! C sto&er Data are su#groups #eneath it. The C stdet an! E1ceptions ta#les are !ata stores. A !ata store is a ta#le" 'ie$" or file that is registere! in a Data Barehouse 7n'ironment or one of its Data Barehouses. SASPBarehouse A!ministrator enforces a certain hierarchy of groups an! !ata stores. For eDample" you can only a!! a Data Barehouse o#/ect to a Data Barehouse 7n'ironment o#/ect.

97 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

De%ine Ite&s ,sed 'loball) BindoB The Define >tems @se! 8lo#ally $in!o$ is use! to !efine glo#al meta!ata for hosts" li#raries" an! other resources that are share! at the 7n'ironment le'el. Ay a!!ing meta!ata recor!s for the resources" you register them in the current 7n'ironment. 9nce these recor!s ha'e #een sa'e!" you can inclu!e them in the meta!ata for o#/ects in the 7n'ironment.

9> 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

T+e -rocess Editor The =rocess 7!itor is use! to manage Co#s. A Cob is a meta!ata recor! that specifies the processes that create !ata stores. A Co# may inclu!e sche!uling meta!ata that ena#les the process to #e eDecute! in #atch mo!e at a specifie! time an! !ate. The =rocess 7!itor $in!o$ contains t$o panels: a Cob List an! a -rocess DieB. The Co# List panel !isplays all of the Co#s that are !efine! in the current Data Barehouse 7n'ironment. The =rocess <ie$ panel !isplays the process flo$ for the Co# that is selecte! in the Co# List. A process %loB is a !iagram that is compose! of sym#ols" $ith connecting arro$s an! !escripti'e teDt" that illustrate the se(uence of each process that is associate! $ith a Co#. The process flo$ illustrates ho$ the !ata mo'es from input source,s- to output ta#le,san! $hat eDtractions an! transformations occur in #et$een.

ETL process
ETL EE1tractF Trans%or& and Load9 is a process in !ata $arehousing responsi#le for pulling !ata out of the source systems an! placing it into a !ata $arehouse. 7TL in'ol'es the follo$ing tas%s: F E1tractin$ t+e data from source systems ,SA=" 75=" other oprational systems-" !ata from rea!y for transformation processing.

99 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

!ifferent source systems is con'erte! into one consoli!ate! !ata $arehouse format $hich is

F Trans%or&in$ t+e data may in'ol'e the follo$ing tas%s: U U U U U U U applying #usiness rules ,soFcalle! !eri'ations" e.g." calculating ne$ measures an! cleaning ,e.g." mapping ;@LL to 0 or S:aleS to S:S an! SFemaleS to SFS etc.-" filtering ,e.g." selecting only certain columns to loa!-" splitting a column into multiple columns an! 'ice 'ersa" /oining together !ata from multiple sources ,e.g." loo%up" merge-" transposing ro$s an! columns" applying any %in! of simple or compleD !ata 'ali!ation ,e.g." if the first columns in a ro$ are !imensions-"

empty then re/ect the ro$ from processingF loadin$ t+e data into a !ata $arehouse or !ata repository other reporting applications

ETL tools
List o% t+e &ost pop lar ETL tools0 U >nformatica F =o$er Center U >A: F Be#sphere DataStage,Formerly %no$n as Ascential DataStageU SA= F Ausiness9#/ects Data >ntegrator U >A: F Cognos Data :anager ,Formerly %no$n as Cognos DecisionStreamU :icrosoft F SQL Ser'er >ntegration Ser'ices U 9racle F Data >ntegrator ,Formerly %no$n as Sunopsis Data Con!uctorU SAS F Data $arehouse U 9racle F Barehouse Auil!er U AA >nitio U >nformation Auil!ers F Data :igrator U =entaho F =entaho Data >ntegration U 7m#arca!ero Technologies F DTPStu!io U >OA; F 7TL1ALL U >A: F DA2 Barehouse 7!ition U =er'asi'e F Data >ntegrator U 7TL Solutions Lt!. F Transformation :anager U 8roup 1 Soft$are ,Sagent- F DataFlo$ U Sy#ase F Data >ntegrate! Suite 7TL U 7Dpressor Soft$are F 7Dpressor Semantic Data >ntegration System U 7liDir F 7liDir 5epertoire U Talend 6 Talend Open St dio

1"" 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

U 9penSys F Clo'er7TL

WIN SAS/DWH ADMIN--2.3B ------------------------G"I TOOL --WE CAN DESIGN A DWH --WE CAN CREATE A DWH --WE CAN MAINTAIN 6ARIO"S DWH(S) WHAT IS MEAN $ DWH! ----------------------A DATAWAREHO"SE IS COLLECTION O* DATA *ROM ONE OR MORE DATA SO"RCES *OR THE P"RPOSE O* Q"ER$ T ANAL$SIS . SAS/ETL ! --------E--ERTRACTION T--TRANS*ORM L--LODING

AD6ANTAGES O* SAS/DWH ---------------------DWH IS MADE EAS$ OTHER ETL TOOLS! ----------------COGNOS -- O --IN*ORMATICA --SAP/ I --SAP/ W --DATASTAGE SO*TWARE REQ"IREMENTS ----------------------------1. ASE SAS 2.SAS/ACCESS
1"1 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

3.ORACLE DATA ASE 4.SAS/WAREHO"SE ADMINI 2.3 5.WG>L=H<-2000/D8/@G<;B/7F/7 HARDWARE REQ"IREMENTS --------------------1.P-I6 PA=98<<=A 2.MG> 1 G RBD STEPS IN6OL6ED IN DWH PROGRAMMING ---------------------------------1.CREATE SO"RCE DATA(ORACLE) 2.SET"P DWH EN6IRONMENT 3.ADD DWH TO DWH EN6IRONMENT 5.ETL PROCESS

STEP:1 CREATE SOURCE DATA5ORACLE6


3S/+ 4AM/* 5O44 AS S6SD7A &ASS)O+D* /4"/+, /4"/+ S8 9:+A4" +/SO3+5/, 5O44/5" "O SO3+5/ ;D/4";,;/D 76 SO3+5/2 S8 9:+A4" +/SO3+5/, 5O44/5" "O "A+:/" ;D/4";,;/D 76 "A+:/"2 S8 9/.;"2 3S/+ 4AM/* SO3+5/ &ASS)O+D* SO3+5/ 5O44/5"/D Create the following tables in the User Sour e!: 5+/A"/ "A7 / /M&!/M&4O 43M7/+!(#,/4AM/ 5HA+!$%#,<O7 5HA+!$%#,SA 43M7/+!$%#,7O43S 43M7/+!=#,D/&"4O 43M7/+!%##2 "#S$%& '( %O)S "#&O &A*+$ $,1"# 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757! Page102

5+/A"/ "A7 / D/&" !D/&"4O 43M7/+ !%#, D4AM/ 5HA+ !$%#, O5 5HA+ !$%##2 S8 9/.;"2 5+/A"/ A ,O D/+ >MA;4? ;4 D+;@/ >5? 5+/A"/ A4O"H/+ S37 ,O D/+ >M/"ADA"A? ;4 >MA;4? ,O D/+.

STEP:2 SETUP DA1 ENVIRONMENT


$. /4"/+ D) ;4 5OMMA4D ;4/ A4D &+/SS /4"/+. %. +;:H" 5 ;5A O4 /M&"6 S&A5/ ;4 )A+/HO3S/ ADM;4;S"+A"O+. '. ADD ;"/M (. S/ /5" DA"A )A+/HO3S/ /4@;+O4M/4". =. &A"H * 5*BMA;4 OA C. 4AM/ * /mpD/nv OA E. D7 5 ;5A O4 $,-.$#/ ;4 SASFD)H /4@;+O4M/4". G. :O"O ,; / ----9 S/ /5" S/"3&

D$F"#$ "&$,S US$D 0+O*A++1:


". D*,S CO##$C&"O#S* $. ADD!,O+ SO3+5/# %. :/4/+A -9 4AM/ -9 SO3+5/DD7 '. D/"A; S -9 D7MS 4;5A 4AM/ -9 O+A5 / -9 6/S (. 3S/+FS5H/MA -9 SO3+5/ -9 &ASSO)+D =. 4/) &ASS)O+D -9 SO3+5/!/4"/+# C. @/+;,6 &ASS)O+D -9 SO3+5/!/4"/+# E. OA G. O D &ASSO)+D -9 OA H. O&";O4S -9 4O" +/83;+/D -9 OA $I. ADD !,O+ "A+:/"# $$. :/4/+A -9 4AM/ -9 "A+:/"DD7 $%. D/"A; S -9 D7MS 4;5A 4AM/ -9 O+A5 / -9 6/S $'. 3S/+FS5H/MA -9 "A+:/" -9 &ASSO)+D $(. 4/) &ASS)O+D -9 "A+:/" !/4"/+# $=. @/+;,6 &ASS)O+D -9 "A+:/" !/4"/+# $C. OA $E. O D &ASSO)+D -9 OA $G. O&";O4S -9 4O" +/83;+/D -9 OA 1"4 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

"".SAS +"*%A%"$S: $. %. '. (. =. C. ADD ! ,O+ SO3+5/# :/4/+A -9 4AM/ -9 S+5D ;7 D/"A; S -9 /" "H/ SAS S6S"/M ASS;:4 "H/ ;7+A+6 ;7+/, -9 S+5D ;7 /4:;4/ -9 O+A5 / 5O44/5";O4 -9 "H;S ;7+A+6 ;S A DA"A7AS/ 5O44/5";O4 ;7+A+6 E. 5O44/5";O4 -9 SO3+5/DD7 -9 OA -9 6/S -9 OA -9 OA G. ADD !,O+ "A+:/"# H. :/4/+A -9 4AM/ -9 "+:D ;7 $I. D/"A; S -9 /" "H/ SAS S6S"/M ASS;:4 "H/ ;7+A+6 $$. ;7+/, -9 "+:D ;7 $%. /4:;4/ -9 O+A5 / $'. 5O44/5";O4 -9 "H;S ;7+A+6 ;S A DA"A7AS/ 5O44/5";O4 ;7+A+6 $(. 5O44/5";O4 -9 "A+:/"DD7 -9 OA -9 6/S -9 OA -9 OA '(. C%$A&$ A #$) +"*%A%1 "# SAS +"*%A%1 )"#DO). $C. 4AM/ -9 S":D ;7 $E. /4:;4/ -9 @H $G. &A"H -9 5*BS":D ;7 -9 OA $H. %I. %$. %%. %'. ADD !,O+ S"A:;4:# :/4/+A -9 4AM/ -9 S":D ;7 D/"A; S -9 "H/ 3S/+ ); &+/- ASS;:4 "H/ ;7+A+6 ;7+/, -9 S/ /5" S":D ;7 -9 OA 5O44/5";O4 -94O" +/83;+/D -9OA

""" 2OS&S: $. ADD -9 :/4/+A -9 4AM/ -9 HOS" %. HOS" O&";O4S -9 SAS @/+S;O4 -9 @H '. HOS" OS -9 );4DO)S -9 OA "/ SC2$DU+"#0 S$%/$%S: $. %. '. (. ADD -9 );4DO)S 4" A" 5OMMA4D -9 OA :/4/+A -9 S5H/D3 /+ 4AM/ -9 S5H/D3 /+ D;+/5"O+;/S -9 O5A )O+A;4: D;+/5"O+6 -9 5*BMA;4 HOS" -9 5OM&3"/ HOS" -9HOS" -9 OA -9 OA

1"! 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

(ight -lic, on 0D2Z0:C ; QAdd Ltem ; EBB 1roup .Eperation data definition 1roup/ (- on EBB 1(E62_ Add Ltem _ Select EBB

ODD 2 ODDS
(- on 1 EBB _ 2roperties 1eneral _ :ame _ 0D2 .9able/ Bata location _ 3ES9 _ ` 3ost SAS %ibrary _ ` S(-Z%L$ SAS 9able or Ciew _ ` Select 0D2.9able/ _ EK -olumns _ (- on 0mpty Space _ Lmport ` Select Supplied Bata location _ E, (- on #nd EBB _ 2roperties 1eneral _ :ame _ B029 .9able/ Bata %ocation _ 3ES9 _ ` 3ES9 SAS %ibrary _ ` S(-Z%L$ SAS 9able or Ciew _ ` Select B029 .9able/ _ EK -olumns _ (- on 0mpty Space _ Lmport ` Select Supplied Bata %ocation _ EK
st

STEP:3 ADD DA1 TO DA1 ENVIRONMENT


(- En 0mpZ0nv _ Add Ltem _ Bata warehouse .%eft Side/ 1eneral _ Jarehouse :ame _ 0D2ZBJ3 Detadata %ocation _ Jarehouse %ibrary ` 1eneral _ :ame _ BJ3ZD09ABA9A Betails _ %ibref _ BJDB .Befault/ 2ath _ -AWDAL:WD09ABA9A _ EK _ EK _ EK (- En SA%0SZBJ3 _ Add Ltem _ Subject (- En Subject _ 2roperties 1eneral _ :ame _ 0D2ZSA%A(L0SZS6$N _ EK (- En 0D2ZSA%A(L0SZS6$N _ Add Ltem _ Bata 1roup 1"5 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

(- En BA9A 1(E62 _ Add Ltem _ Bata 9able .=or merging 0mp ^ Bept/ (- En BA9A 1(E62 _ Add Ltem _ Bata 9able .=or (0S6%9/ (- En 1st Bata 9able _ 2roperties ` 1eneral _ Bata 9able :ame _ D0(1L:1 -olumns _ (- En 0mpty Space _ Lmport _ Select Eperational Bata Sources

-a !e 0D2 _

/o!umns -hoose 0D2:E, 0:AD0, NE$, SA%, -EDD, B029:E -hoose B:AD0, %E-

B029 _

2hysical Storage _ Storage format _ SAS %oad 9echni+ue _ ` (efresh Befine _ %ocation _ 3ES ` 3ES9 SAS Bata %ibrary _ S91Z%L$ SAS Bata Set :ame _ D0(1L:1 .9ype/ _ EK _ EK 8/ 4n 2n1 )ata -a !e [ %ro,erties 1eneral _ Bata 9able :ame _ (0S6%9 -olumns _(- En 0mpty Space _ Lmport _ Select Bata 9ables 9able -olumns D0(1L:1 '''Q -hoose all the -olumns EK

8/ 4n 3m,ty S,a#e [ 7e0 [ 7ame [ 73-TSA.A8; R7umeri#A .-olumn/ ` Page102 2hysical Storage _ Storage format _ B$DS %oad 9echni+ue _ (efresh Befine _ %ocation _ 3ES9 ` 3ES9 1" 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

-onnection _ B$DS %ibname _ 9(1Z%L$ 9able :ame _ .9ype/ (0S6%9 _ EK _ O0S _ EK

STEP:4 ETL PROCESS


S4*8/3 3-. %84/3SS 8/ 4n &389+79_ 2(E-0SS _ O0S .%eft Side/ 8/ 4n &389+79 _ ABB _ Lnputs _ 9able 9ype _ Select .(ight Side/ EBB _ Show _ Select All _ EK 8/ 4n &a,,in' _ 2roperties ` 1eneral _ :ame _ D0(1L:1ZDA22L:1 07ecution _ -ompute 3ES9 _ ` 3ES9 Eutput Bata _ Bataset :ame _ D0(1L:1.9ype/ Bata 3ES9 _ ` 3ES9 ` 1eneration Eptions ` (ow Selection _ (ow Selected _ Select ` (ow Selection -onditions ` Befine _ Select Lnput 9able ` +n,ut -a !es /o!umns 0D2 B029 _ _ B029:E M B029:E _ EK_ EK

/o!umn &a,,in' ` 1 ; 1Dappings Source 9able _ 0D2 ` _ 8uic, Dap _ EK _ B029 ` _ 8uic, Dap _ EK Jhere _ Befine _ Select Lnput 9ables

+n,ut -a !es

/o!umns

1"7 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

0D2 _ B029:E M B029 _ B029:E _ EK _ EK 8/ on &389+79 _ 0dit load Step _ 07ecution _ -ompute 3ES9 .(ight Side/ ` 3ES9 _ EK _ Oes 8/ on &389+79 _ Assign %ibref _ Successful assignment of library S91Z%L$ _ EK

.(ight Side/ 8/ 4n &389+79 _ (6: _ S6$DL9 _ -lose .%eft Side/

-A893- 3-. %84/3SS 8/ on 83S*.- _ 2(E-0SS _ O0S .%eft Side/ (- En 0mpty Space _ Select Derge Nob _ Select Nob _ Show ` Select D0(1L:1 ` EK _ O0S 8/ on 83S*.- _ Add _ Lnputs _ Select Bata 9able _ Show ` D0(1L:1 _ EK 8/ on &a,,in' _ 2roperties ` 1eneral _ :ame _ (0S6%9 ZDapping 07ecution_ -ompute 3ES9 _ ` 3ES9 Eutput Bata _ Bataset :ame_ (0S6%9 .9ype/ Bata 3ES9 _ ` 3ES9 -olumn Dapping _ 1 ; 1Dappings _ D0(1L:1 _ 8uic, Dap _ EK Se!e#t 73-TSA.A8; R+n /o!umn ma,,in'sA _ Berive Dappings ` Lnput 9ables _ D0(1L:1_ -olumns ` S6D.SA%,$E:6S/_ EK 8/ on 83S*.- _ EK _ 0dit to load step .(ight Side/ ` 07ecution _ -ompute 3ES9 _ ` 3ES9 _ EK_ O0S 8/ on 83S*.- _ Assign %ibref _ .Successful assignment of lib 9(1Z%L$/ .(ight Side/ 8/ on 83S*.- _ (6: _ S6$DL9_ -lose .%eft Side/ Page102 1"> 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

CLINICAL TRAILS GLOSSARY


A Abnormalit3 A sign, symptom, or la-oratory result not characteristic of normal individuals. Ad4erse e4ent "he ;5H defines an adverse event as* JAny untoKard medical occurrence in a su-Lect or clinical investigation su-Lect administered a pharmaceutical product and Khich does not necessarily have to have a causal relationship Kith this treatment1 !see ;5H :uideline* 5linical safety data management* definitions and standards for expedited reporting#. ,or non-marketed drugsFproduct, or neK indications of marketed drugsFproduct, an adverse event is referred to as an adverse reaction Khen there is a reasona-le possi-ility that it Kas caused -y the medicinal product, i.e. a causal relationship cannot -e ruled out. Ad4erse e5perien e See adverse event. Ad4erse rea tion 3nKanted effect!s# !i.e., physical and psychological symptoms and signs# resulting from treatment. A less rigid definition of adverse reaction includes the previous definition plus any undesira-le effect or pro-lem that is present during the period of treatment and may or may not -e a Kell-knoKn or o-vious complication of the disease itself. "hus, many common personality, physical, psychological, and -ehavioral characteristics that are o-served in medicine studies are sometimes characteriMed as adverse reactions even if they Kere present during -aseline. Synonyms of adverse reactions generally include adverse medical effects, untoKard effects, side effects, adverse drugFproduct experiences, and adverse drugFproduct reactions. Specific distinctions among some of these terms may -e defined operationally. ,or example, the term adverse reaction is used to denote those signs and symptoms at least possi-ly related to a medicine, Khereas the term adverse experiences is used to include nonmedicine-related medical pro-lems in a trial such as those emanating from trauma or concurrent illness. Distinctions among side effects, adverse events, and adverse reactions are illustrated in the definitions of the tKo former terms. * *ias !$# A point of vieK that prevents impartial Ludgment on issues relating to that point of vieK. 5linical trials attempt to control this through dou-le -linding. !%# Any tendency for a value to deviate in one direction from the true value. Statisticians attempt to prevent this type of -ias -y various techniNues, including randomiMation.

1"9 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

*iomar6er A measure that is an indicator of a normal physiologic process, or a pathologic state or the response of an organism to an intervention that can -e used in clinical research. )hen a -iomarker can replace a clinical endpoint it is called a surrogate endpoint. *lind "he term J-lind1 refers to a lack of knoKledge of the identity of the trial treatment. Su-Lects, investigators, date revieK committees, ancillary personnel, statisticians, and monitors are the maLor groups of individuals Kho may -e kept -lind during a clinical trial. 7linding is used to decrease the -iases that occur in a clinical trial Khen su-Lects are evaluated during treatment and to avoid a place-o effect that often occurs in open-la-el trials. C Clini al Drug/-rodu t De4elopment -hase "his classification assumes a seNuential approach to drugFproduct development. HoKever, the clinical pharmacology programmed Kill overlap the later phases Kith a num-er of studies that are reNuired for registration !e.g. interaction studies, or studies in special populations O elderly, renally or hepatically-impaired#, and are performed at the same time as the &hase ;;F;;; studies. Clini al $ndpoint A measure of hoK a su-Lect feels functions or survives. Clini al "n4estigator!s *ro hure An extensive summary of all that is knoKn a-out a research compound Kith regard to pre-clinical and clinical data. Clini al signifi an e "he Nuality of a study?s outcome that convinces physicians to modify or maintain their current practice of medicine. "he greater the clinical significance, the greater is the influence on the practice of medicine. "he assessment of clinical significance is usually -ased on the magnitude of the effect o-served, the Nuality of the study that yielded the data, and the pro-a-ility that the effect is a true one. Although this operational definition is presented from the physician?s perspective, the term could operationally -e defined from the su-Lect?s perspective. Su-Lects are primarily concerned Kith results that Kill lead to an improved Nuality of life or a lengthening of their life. ;n addition, clinical significance may -e applied to either positive data of efficacy or negative safety data such as for adverse reactions. Synonyms include clinical importance, clinical relevance, and clinical meaningfulness.

11" 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

Clini al studies

"he class of all scientific approaches to evaluate medical disease preventions, diagnostic techniNues, and treatments. ;nvestigational and marketed prescription medicine evaluations plus over-the-counter medicines or other agents !dietary supplements# are included. Clini al trials A su-set of those clinical studies that evaluates investigational medicines in &hases ;, ;;, and ;;;. &hase ;@ evaluations of marketed medicines in formal clinical trials using the same or similar types of protocols to those used in &hases ; and ;;; are also referred to as clinical trials. Combination of blinds !a# ;n part $ of a clinical trial, one type of -lind may -e used !e.g., single -lind#, and in part % of the same trial, another -lind !e.g., dou-le -lind# may -e used. A third part of the same trial may utiliMe the same -lind as part $ or use an entirely different type of -lind. !-# Some su-Lects may folloK a protocol under one type of -lind and others folloK the same protocol under a different type of -lind. !c# "he -lind used may -e changed during the course of the clinical trial according to certain criteria !e.g., Khen study is done Kith medical patients, the dou-le -lind may -e -roken, and they may continue their treatment on open-la-el medication#. Complian e $. Adherence of su-Lects to folloKing medical advice and prescriptions. &rimarily applied to taking medicine as directed, -ut also applies to folloKing advice on diet, exercise, or other aspects of a su-Lect?s life. %. Adherence of investigators to folloKing a protocol and related administrative and regulatory responsi-ilities. '. Adherence of sponsors to folloKing regulatory, legal, and other responsi-ilities and reNuirements relating to a clinical trial. Compound A chemical synthesiMed or prepared from natural sources that is evaluated for its -iological activities in preclinical tests. Control 0roup A group of clinical trial participants that receives the place-o or standard therapy for a condition Khile another group is given the experimental treatment. "he control group serves as a measuring stick to gauge the effectiveness of the experimental treatment.

De4elopment of ,edi ines

111 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

"he term development as applied to medicines is used in several different contexts, even Kithin the pharmaceutical industry. "his often leads to confusion and misunderstanding. 4o single definition is preferred, -ut the particular meaning intended should -e made clear -y all people using the term. "hree operational definitions are presented, from the -roadest to the narroKest. $. All stages and processes involved in discovering, evaluating, and formulating a neK medicine, until it reaches the market !i.e., commercial sale#. %. All stages involving the evaluation and formulation of a neK medicine !after the medicine has -een discovered and has gone through preclinical testing#, until it reaches the market. '. "hose stages after the preclinical discovery and evaluation that involve technical development. "hese processes include formulation Kork, sta-ility testing, scaling-up the compound for larger-scale synthesis, and providing analytical support. 5linical trials are not included in this definition. Disease Disorders !e.g., anxiety disorders, seiMure disorders#, conditions !e.g., o-esity, menopause#, syndromes, specific illnesses, and other medical pro-lems that are an acNuired mor-id change in a tissue, organ, or organism. Synonyms are illness and sickness.

Dosage regimen !$# "he num-er of doses per given time period !usually days#, !%# the time that elapses -etKeen doses !e.g., dose to -e given every six hours# or the time that the doses are to -e given !e.g., dose to -e given at G a.m., noon, and ( p.m. each day# or !'# the Nuantity of a medicine !e.g., num-er of ta-lets, capsules, etc.# that are given at each specific time of dosing. Double *lind

4either the su-Lect nor the investigator is aKare of Khich treatment the su-Lect is receiving. A dou-le--lind design is generally considered to provide the most relia-le data from a clinical trial. "his type of clinical trial, hoKever, is usually more complicated to initiate and conduct than single--lind or open-la-el trails. Drug A drug is defined as* = = = A su-stance recogniMed -y an official pharmacopoeia or formulary. A su-stance intended for use in the diagnosis, cure, mitigation, treatment, or prevention of disease.

11# 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

A su-stance !other than food# intended to affect the structure or any function of the -ody.

= =

A su-stance intended for use as a component of of a medicine -ut not a device or a component, part or accessory of a device. 7iologic products are included Kithin this definition and are generally covered -y the same laKs and regulations, -ut differences exist regarding their manufacturing processes !chemical process vs. -iological process.#

Drug -rodu t "he finished dosage form that contains a drug su-stance, generally, -ut not necessarily in association Kith other active or inactive ingredients. Drug/produ t A licit or illicit su-stance that is a-used. Medicines should -e descri-ed as drugsFproduct Khen they are -eing purposely a-used.

$ $ffi a 3 A relative concept referring to the a-ility of a medicine to elicit a -eneficial clinical effect. "his may -e measured or evaluated using o-Lective or su-Lective parameters, and in terms ranging from glo-al impressions, to highly precise measurements. /fficacy is assessed at one or more levels of organiMation !e.g.-su-cellular, cellular, tissue, organ, Khole -ody# and may -e extrapolated to other levels. $ndpoint An indicator measured in a su-Lect or -iological sample to assess safety, efficacy, or another trial o-Lective. Some endpoints are derived from primary endpoints !e.g., cardiac output is derived from stroke volume and heart rate#. Synonyms include outcome, varia-le, parameter, marker, and measure. See surrogate endpoint in the text. Also defined as the final trial o-Lective -y some authors. $thi s Committee An independent group of professionals often complimented -y a non-scientific mem-er of the pu-lic responsi-le for approval of study protocols -efore a study is actually carried out. Su-Lect safety and scientific integrity of the protocol are the main concerns. 0 0ood Clini al -ra ti e A standard to ensure protection of research su-Lects and data integrity in clinical studies of neK drugsFproduct. "

114 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

"n iden e rate "he rate of occurrence of neK cases of a disease, adverse reaction, or other event in a given population at risk !e.g., the incidence of disease . is 6 su-Lects per year per $II,III population#. "nternational Conferen e on 2armoni7ation "he ;nternational 5onference on HarmoniMation !;5H# has produced guidelines on :ood 5linical &ractice !:5&# encompassing the reNuirements of the /uropean 3nion !/3#, <apan and the 3nited States !3S# as Kell as those of the )orld Health OrganiMation !)HO#, Australia, 4eK Pealand and the 4ordic countries !;5H "opic /C, :uidelines on :ood 5linical &ractice#. "nterpretation "he processes Khere-y one determines the clinical meaning or significance of data after the relevant statistical analyses have -een performed. "hese processes often involve developing an explanation of the data that are -eing evaluated. "n4estigator A suita-ly trained scientist !often medically Nualified# involved in the execution of a clinical drugFproduct study. "he person Kith ultimate responsi-ility for this is called principle or responsi-le investigator. , ,edi ine )hen a compound or su-stance is tested for -iological and clinical activity in humans, it is considered to -e a medicine. Some individuals prefer to define a medicine as a compound that has demonstrated clinically useful properties in su-Lects. "his definition, hoKever, Kould restrict the term to use sometime during or after phase ;;. Others use the term loosely and apply it to compounds Kith -iological properties during the preclinical period that suggest medical usefulness in humans. "he author has adopted the first definition for use in this -ook. ,ed )at h 8FDA9A$%!s: "he Adverse /vent +eporting System !A/+S# is a computeriMed information data-ase designed to support the ,DAQs post-marketing safety surveillance program for all approved drug and therapeutic -iologic products. "he ultimate goal of A/+S is to improve the pu-lic health -y providing the -est availa-le tools for storing and analyMing safety reports. "he ,DA receives adverse drug reaction reports from manufacturers as reNuired -y regulation. Health care professionals and consumers send reports voluntarily through the Med)atch program. "hese reports -ecome part of a data-ase. "he structure of this data-ase is in compliance Kith the international safety reporting guidance !KKK.fda.govFmedKatchFreportFiche%-.pdf# issued -y the ;nternational 5onference on Harmonisation. "he guidance descri-es the content and format for the electronic su-mission of reports from manufacturers. ,DA codes all reported adverse events using a standardiMed international terminology, MedD+A !the Medical Dictionary for

11! 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

+egulatory Activities#. Among A/+S system features are* the on-screen revieK of reports2 searching tools2 and various output reports. ,DA staff use reports from A/+S in conducting postmarketing drug surveillance and compliance activities and in responding to outside reNuests for information. "he reports in A/+S are evaluated -y clinical revieKers in the 5enter for Drug /valuation and +esearch !5D/+# and the 5enter for 7iologics /valuation and +esearch !57/+# to detect safety signals and to monitor drug safety. "hey form the -asis for further epidemiological studies Khen appropriate. As a result, the ,DA may take regulatory actions to improve product safety and protect the pu-lic health, such as updating a product?s la-eling information, sending out a RDear Health 5are &rofessionalR letter, or re-evaluating an approval decision. O Open9+abel Stud3 4o -lind is used. 7oth investigator and su-Lect knoK the identity of the medicine. -harma o9D3nami s "he scientific discipline involved in the study of drugFproduct action on molecular or cellular targets or on the Khole organism. -harma o96ineti s "he study of the time course of the concentration of a su-stance and its meta-olites in -ody fluids like -lood and urine. -hases of lini al trials and medi ine de4elopment ,our phases of clinical trials and medicine development exist and are defined -eloK. /ach of these definitions is a functional one and the terms are not defined on a strict chronological -asis. An investigational medicine is often evaluated in tKo or more phases simultaneously in different clinical trials. Also, some clinical trials may overlap tKo different phases. -hase " 5linical &harmacology Studies in healthy volunteers !sometimes su-Lects# to determine the safety and tolera-ility of the drugFproduct, other dynamic effects and the pharmacokinetic profile !a-sorption. distri-ution, meta-olism and excretion O ADM/#. /vidence of efficacy may -e gained if su-Lects, disease models or -iomarkers are used. -hase "" 5linical ;nvestigation studies in su-Lects Kith the target disease, to determine efficacy, safety and tolera-ility in carefully controlled dose-ranging studies.

115 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

-hase ""a &ilot clinical trials to evaluate efficacy !and safety# in selected populations of su-Lects Kith the disease or condition to -e treated, diagnosed, or prevented. O-Lectives may focus on dose-response, type of su-Lect, freNuency of dosing, or numerous other characteristics of safety and efficacy. -hase ""b )ell-controlled trials to evaluate efficacy !and safety# in su-Lects Kith the disease or condition to -e treated, diagnosed, or prevented. "hese clinical trials usually represent the most rigorous demonstration of a medicine?s efficacy. -hase """ ,ormal clinical trials. arge-scale place-o controlled and active comparator studies in su-Lects to confirm efficacy, and provide further information on the safety and tolera-ility of the drugFproduct. -hase """a "rials conducted after efficacy of the medicine is demonstrated, -ut prior to regulatory su-mission of a 4eK DrugFproduct Application !4DA# or other dossier. "hese clinical trials are conducted in su-Lects? populations for Khich the medicine is eventually intended. &hase ;;;a clinical trials generate additional data on -oth safety and efficacy in relatively large num-ers of su-Lects in -oth controlled and uncontrolled trials. 5linical trials are also conducted in special groups of su-Lects !e.g. renal failure su-Lects#, or under special conditions dictated -y the nature of the medicine and disease. "hese trials often provide much of the information needed for the package insert and la-eling of the medicine. -hase """b 5linical trials conducted after regulatory su-mission of an 4DA or other dossier, -ut prior to the medicine?s approval and launch. "hese trials may supplement earlier trials, complete earlier trials, or may -e directed toKards neK types of trials !e.g., Nuality of life, marketing# or phase ;@ evaluations. "his is the period -etKeen su-mission and approval of a regulatory dossier for marketing authoriMation. -hase "/ &ost-marketing surveillance to expand safety and efficacy data in a large population, including further formal therapeutic trials and comparisons Kith other active comparators.

A pilot trial is used to o-tain information, and Kork out the logistics and management, deemed necessary for further clinical trials. Although pilot trials are

11

2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

-ilot Stud3

often un-lind and use open-la-el medicines, they may also -e single or dou-le -lind and may include tight control on all appropriate varia-les. "he term Jpilot1 refers to the purpose of the trial !%#. -la ebo Means J; shall please1 in atin2 it is a term applied to a remedy that does not affect the Jspecific mechanisms1 of the disease in Nuestion, or to the favora-le response that the treatment often elicits.

-re9 lini al Drug/produ t De4elopment "he studies done in cells, tissues and Khole animals as Kell as the chemical and pharmaceutical investigations to o-tain adeNuate Assurance that a neK drugFproduct may safely -e given to man in clinical studies. -re4alen e "he total num-er of people in a population that are affected Kith a particular disease at a given time. "his term is expressed as the rate of all cases !e.g., the prevalence of disease . is 6 su-Lects per $II,III population# at a given point or period of time. ; ;ualit3 Assuran e "he procedures ad control systems in place during a clinical trial to ensure integrity of the data and protection of the su-Lects. ;ualit3 Control "he checks performed to ensure that the Nuality control system is adhered to. % %andomi7ation /ach su-Lect has a treatment, -ut the randomness accords distinct from those of

knoKn chance, usually eNual chance, of -eing given each treatment to -e given cannot -e predicted. "he idea of Kith our intuitive ideas of chance and pro-a-ility, -ut it is haphaMard or ar-itrary allocation.

%esear h8on medi ines: 4umerous definitions of research are used -oth in the literature and among scientists. ;n the -roadest sense, research in the pharmaceutical industry includes all processes of medicine discovery, preclinical and clinical evaluation, and technical development. ;n a more restricted sense, research concentrates on the preclinical discovery phase, Khere the -asic characteristics of a neK medicine are determined. Once a decision is reached to study the medicine in humans to evaluate its

117 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

therapeutic potential, the compound passes from the research to the development phase. %esear h and de4elopment )hen research and development are used together, it refers to the -roadest definition for research !see a-ove#. Some people use the term research colloNuially to include most or all of the scientific and medical areas !discovery, evaluation, and development# covered -y the single term research and development. Medicine development has several definitions and, in its -roadest definition, is exactly the same as the -road definition of research. %is6 A measure of !$# the pro-a-ility of occurrence of harm to human health or !%# the severity of harm that may occur. Such a measure includes the Ludgment of the accepta-ility of risk. Assessment of safety involves Ludgment, and there are numerous perspectives !e.g., su-Lects, physicians, company, regulatory authorities# used for Ludging it.

S Safet3 A relative concept referring to the freedom from harm or damage resulting from adverse reactions or physical, psychological, or -ehavioral a-normalities that occur as a result of medicine or nonmedicine use. Safety is usually measured Kith one or more of the folloKing* physical examination !e.g., vital signs, neurological, opthalmological, general physical#, la-oratory evaluations of -iological samples !e.g., hematology, clinical chemistry, urinalysis#, special tests and procedures !e.g., electrocardiogram, pulmonary function tests#, psychiatric tests and evaluations, and determination of clinical signs and symptoms. Satellite site A secondary site at Khich su-Lects in a clinical trial are seen, usually -y the same investigator Kho sees su-Lects at the primary site. A satellite site may -e the same type of site !e.g., private office, hospital# or a different type from the primary site. Serious Ad4erse $4ent 8SA$: An adverse event that leads to death, permanent disa-ility or !prolongation of# hospital admission. "hese events are of o-vious importance to authorities and felloK researchers Korking on the same drugFproduct and have to -e reported to the local and international authorities Kith the greatest possi-le urgency. "he details of the reporting are given in the study protocol.

Multiple definitions are possi-le and no single one is correct in all situations. ;n general usage referring to su-Lects in clinical trials, a serious adverse reaction may

11> 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

Serious ad4erse rea tion

-e !$# any -ad adverse reaction that is o-served, !%# any -ad adverse reaction that one does not expect to o-serve, !'# any -ad adverse reaction that one does not expect to o-serve and is not in the la-el, or !(# any -ad adverse reaction that has not -een reported Kith standard therapy. Definitions may also -e -ased on the degree to Khich an adverse reaction compromises a su-Lect?s function or reNuires treatment. A common used definition is Jan adverse event that leads to death, permanent disa-ility or !prolongation of# hospital admission1. "he details of reporting these events are often given in the study protocol. Side effe t Any effect other than the primary intended effect!s# resulting from medicine or nonmedicine treatment or intervention. Side effects may -e negative !i.e., an adverse reaction#, neutral, or positive !i.e., a -eneficial effect# for the su-Lect. "his term, therefore, includes all adverse reactions plus other effects of treatment. See definition of adverse reaction. Single blind "he su-Lect is unaKare of Khich treatment is -eing received, -ut the investigator has this information. ;n unusual cases, the investigator and not the su-Lect may -e kept -lind to the identity of the treatment. Site "his refers to the place Khere a clinical trial is conducted. A physician Kho has offices and sees su-Lects in three separate locations is vieKed as having one site. A physician Kho is on the staff of four hospitals could -e vieKed as having one or four sites, depending on hoK similar or different the su-Lect populations are and Khether the data from these four locations Kill -e pooled and considered a single site. ,or example, a single physician Kho enrolls groups of su-Lects at a university hospital, private clinic, community hospital, and @eterans Administration Hospital should generally -e vieKed as having four sites, since the su-Lect populations Kould -e expected to differ at each site. See satellite site. Sponsor An organiMation !often a pharmaceutical company# funding a trial of a neK drugFproduct or other intervention for registration purposes. Standard Operating -ro edure 8SO-: A detailed description of a certain activity or organiMing principle in a clinical trial. Such procedures must -e adhered to Khen performing a trial under the :ood 5linical &ractice standards. Statisti al "his term relates to the pro-a-ility that an event or difference signifi an eoccurred -y chance alone. "hus, it is a measure of Khether a difference is likely to -e real, -ut it does not indicate Khether the difference is small or large, important or trivial. "he

119 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

level of statistical significance depends on the num-er of su-Lects studied or o-servations made, as Kell as that magnitude of difference o-served. Stud3 -roto ol "he document descri-ing the rationale, the su-Lect population, the drugsFproduct to -e used and the full time schedule of a clinical study as Kell as the endpoints to -e evaluated. "he study protocol for independent evaluation. Surrogate endpoint A -iomarker that has -een extensively studied to -e sufficiently confident that it can replace a clinical endpoint for registration purposes. & &herapeuti window "his term is applied to the difference -etKeen the minimum and maximum doses that may -e given su-Lects to o-tain an adeNuate clinical response and avoid intolera-le toxic effects. "he greater the value calculated for the therapeutic KindoK, the greater a medicine?s margin of safety. Synonyms are therapeutic ratio and therapeutic index.

/ /olunteer A normal individual Kho participates in a clinical trial for reasons other than medical need and Kho does not receive any direct medical -enefit from participating in the trial.

1#" 2repared by 1anesh -h,i'Solutions,3yderabad,"9491#9757!

Page102

You might also like