Documente Academic
Documente Profesional
Documente Cultură
80% data-related
$ access
$ scr!
$ transform
$ manage
$ store and retrieve
20% analysis
SAS Presentation | | 7/27/14
%
SAS Presentation | | 7/27/14
7
SAS Presentation | | 7/27/14
&
Basic concepts of SAS
'vervie"
SAS Programs
SAS (i!raries
*aria!le Attri!tes
SAS Presentation | | 7/27/14
+
Oerie!
To program effectively sing SAS, yo need to nderstand !asic
concepts a!ot SAS programs and the SAS files that they process- .n
particlar, yo need to !e familiar "ith SAS data sets-
SAS Presentation | | 7/27/14
1/
SAS "rogram
0o can se SAS programs to access, manage, analy1e, or present yor
data-
(et2s !egin !y loo3ing at a simple SAS program-
DATA SAMPLE;
INPUT NAME $10.;
DATALINES;
ANIL
ARUN;
RUN;
PROC PRINT DATA=SAMPLE;
RUN;
SAS Presentation | | 7/27/14
11
Components of SAS "rograms # Sample code
'r sample SAS program contains t"o steps# a 4ATA step
and a P)'5 step-
DATA SAMPLE;
INPUT NAME $10.;
DATALINES;
ANIL
ARUN;
RUN;
PROC PRINT DATA=SAMPLE;
RUN;
Continued$
SAS Presentation | | 7/27/14
12
Components of SAS "rograms # DATA ST%"& "'OC ST%"
T(ese t!o types of steps& alone or com)ined& form most SAS programs*
Continued$
SAS Presentation | | 7/27/14
13
DATA steps typically create or modify SAS data sets- They can also !e sed to prodce
cstom designed reports- 6or e7ample, yo can se 4ATA steps to
compte vales
prodce ne" SAS data sets !y s!setting, merging, and pdating e7isting data sets-
"'OC +procedure, steps are pre8"ritten rotines that ena!le yo to analy1e and
process the data in a SAS data set and to present the data in the form of a report- P)'5
steps sometimes create ne" SAS data sets that contain the reslts of the procedre-
P)'5 steps can list, sort, and smmari1e data- 6or e7ample, yo can se P)'5 steps
to
SAS data set names can !e 1 to 32 characters long, mst !egin "ith
a letter @A-E, either ppercase or lo"ercaseA or an nderscore @FA,
and can contine "ith any com!ination of nm!ers, letters, or
nderscores-
SAS Presentation | | 7/27/14
21
SAS Data Sets
The descriptor portion of a SAS data set contains information a!ot the data set-
The data portion of a SAS data set is a collection of data vales that are arranged in a
rectanglar ta!le-
O)serations in the data set correspond to ro"s or data lines in a ra" data file
or in an e7ternal data!ase- An o!servation is the information a!ot each o!Gect in a SAS
data set-
5aria)les in the data set correspond to colmns in a ra" data file or in an e7ternal
data!ase-
SAS Presentation | | 7/27/14
22
5aria)le Attri)utes
varia!le:s name,
type,
length,
format,
informat, and
la!el-
/ame
Cach varia!le has a name that conforms to SAS naming conventions- *aria!le names
follo" e7actly the same rles as SAS data set names- (i3e data set names, varia!le
names
mst !egin "ith a letter @A-E, either ppercase or lo"ercaseA or an nderscore @FA
5haracter varia!les can !e p to 62&787 )ytes long- .n the e7ample !elo", 9ame
has a length of 2/ characters and ses 2/ !ytes of storage-
All nmeric varia!les have a defalt length of 8- 9meric vales @no matter ho"
many digits they containA are stored as floating8point nm!ers in & !ytes of storage,
nless yo specify a different length-
5aria)le Attri)utes
Continued$
SAS Presentation | | 7/27/14
25
5aria)le Attri)utes
2ormat
6ormats are varia!le attri!tes that affect the "ay data vales are "ritten- SAS
soft"are offers a variety of character, nmeric, and date and time formats- 0o
can also create and store yor o"n formats- To "rite vales ot sing a
particlar form, yo select the appropriate format-
Continued$
SAS Presentation | | 7/27/14
2%
5aria)le Attri)utes
Informat
2ormats "rite vales out !y sing some particlar form "hereas informats read data vales in
certain forms into standard SAS vales- .nformats determine ho" data vales are read into a SAS
data set- 0o must se informats to read nmeric vales that contain letters or other special
characters-
Continued$
SAS Presentation | | 7/27/14
27
5aria)le Attri)utes
.a)el