(Ebook PDF) SAS Certified Specialist Prep Guide: Base Programming Using SAS 9.4 - The Ebook in PDF/DOCX Format Is Ready For Download Now
(Ebook PDF) SAS Certified Specialist Prep Guide: Base Programming Using SAS 9.4 - The Ebook in PDF/DOCX Format Is Ready For Download Now
com
https://ebookluna.com/product/ebook-pdf-sas-certified-
specialist-prep-guide-base-programming-using-sas-9-4/
OR CLICK HERE
DOWLOAD EBOOK
https://ebookluna.com/product/original-pdf-sas-certification-prep-
guide-base-programming-for-sas9-fourth-edition/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-business-analytics-using-sas-
enterprise-guide-and-sas-enterprise-miner/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-introduction-to-programming-
using-python-an-1/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-introduction-to-programming-
using-visual-basic-10th-edition/
ebookluna.com
CCSP Certified Cloud Security Professional. Exam Guide 3rd
Edition Unknown - eBook PDF
https://ebookluna.com/download/ccsp-certified-cloud-security-
professional-exam-guide-ebook-pdf/
ebookluna.com
https://ebookluna.com/download/ccsp-certified-cloud-security-
professional-all-in-one-exam-guide-ebook-pdf-2/
ebookluna.com
https://ebookluna.com/product/ceh-certified-ethical-hacker-all-in-one-
exam-guide-4th-edition-ebook-pdf/
ebookluna.com
https://ebookluna.com/download/cc-certified-in-cybersecurity-all-in-
one-exam-guide-ebook-pdf/
ebookluna.com
https://ebookluna.com/product/prepare-your-data-for-tableau-a-
practical-guide-to-the-tableau-data-prep-tool-ebook-pdf/
ebookluna.com
viii How to Prepare for the Exam
On the Web
Bookstore www.sas.com/books
Certification www.sas.com/certify
Communities communities.sas.com
SAS Global Academic Program www.sas.com and click Learn. Then select
For Students and Educators.
Training www.sas.com/training
Syntax Conventions
• DROP= and KEEP= are separated by a vertical bar ( | ) to indicate that they are
mutually exclusive.
The example syntax that is shown in this book includes only what you need to know in
order to prepare for the certification exam. For complete syntax, see the appropriate SAS
reference guide.
x How to Prepare for the Exam
xi
Overview
The SAS Certified Specialist Prep Guide: Base Programming Using SAS 9.4 is a test
preparation document that uses the following environments and products:
• SAS windowing environment
• SAS Enterprise Guide
• SAS Studio or SAS University Edition
Documentation Format
Contact [email protected] if you need this document in an alternative digital
format.
xii Accessibility Features of the Prep Guide
1
Part 1
Chapter 1
Setting Up Practice Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Chapter 2
Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Chapter 3
Accessing Your Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Chapter 4
Creating SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Chapter 5
Identifying and Correcting SAS Language Errors . . . . . . . . . . . . . . . . . 59
Chapter 6
Creating Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Chapter 7
Understanding DATA Step Processing . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Chapter 8
BY-Group Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Chapter 9
Creating and Managing Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Chapter 10
Combining SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Chapter 11
Processing Data with DO Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Chapter 12
SAS Formats and Informats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
2
Chapter 13
SAS Date, Time, and Datetime Values . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Chapter 14
Using Functions to Manipulate Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Chapter 15
Producing Descriptive Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
Chapter 16
Creating Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
3
Chapter 1
Requirements
To complete examples in this book, you must have access to SAS Studio, SAS
Enterprise Guide, or the SAS windowing environment.
Instructions
1. Navigate to support.sas.com/content/dam/SAS/support/en/books/data/base-guide-
practice-data.zip, download and save the practice data ZIP file.
2. Unzip the file and save it to a location that is accessible to SAS.
3. Open the cre8data.sas program in the SAS environment of your choice.
• SAS Studio: In the Navigation pane, expand Files and Folders and then navigate
to the Cert folder within the practice-data folder.
• SAS Enterprise Guide: In the Servers list, expand Servers ð Local ð Files, and
then navigate to the Cert folder in the practice-data folder.
• SAS windowing environment: Click File ð Open Program, and then navigate
to the Cert folder in the practice-data folder.
4. In the Path macro variable, replace /folders/myfolders with the path to the
Cert folder and run the program.
%let path=/folders/myfolders/cert;
4 Chapter 1 • Setting Up Practice Data
Important: The location that you specify for the Path macro variable and the
location of your downloaded SAS programs should be the same location.
Otherwise, the cre8data.sas program cannot create the practice data.
Your practice data is now created and ready for you to use.
TIP When you end your SAS session, the Path macro variable in the
cre8data.sas program is reset. To avoid having to rerun cre8data.sas every
time, run the libname.sas program from the Cert folder to restore the libraries.
Visit https://testbankfan.com
now to explore a rich
collection of testbank or
solution manual and enjoy
exciting offers!
5
Chapter 2
Basic Concepts
Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
The Basics of the SAS Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
SAS Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Global Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
DATA Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
PROC Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
SAS Program Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Processing SAS Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Log Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Results of Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
SAS Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Predefined SAS Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Defining Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
How SAS Files Are Stored . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Storing Files Temporarily or Permanently . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Referencing SAS Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Referencing Permanent SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Referencing Temporary SAS Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Rules for SAS Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
VALIDVARNAME=System Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
VALIDMEMNAME=System Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
When to Use VALIDMEMNAME=System Option . . . . . . . . . . . . . . . . . . . . . . . . . 17
SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Overview of Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Descriptor Portion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
SAS Variable Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Data Portion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
SAS Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Extended Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Chapter Quiz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6 Chapter 2 • Basic Concepts
Getting Started
In the SAS 9.4 Base Programming – Performance-Based exam, you are not tested on the
details of running SAS software in the various environments. However, you might find
such information useful when working with the practice data.
You can access a brief overview of the windows and menus in the SAS windowing
environment, SAS Enterprise Guide, and SAS Studio at http://video.sas.com/. From
Categories select How To Tutorials ð Programming. Select the video for your SAS
environment. Other tutorials are available from the SAS website.
SAS Statements
A SAS statement is a type of SAS language element that is used to perform a particular
operation in a SAS program or to provide information to a SAS program. SAS
statements are free-format. This means that they can begin and end anywhere on a line,
that one statement can continue over several lines, and that several statements can be on
the same line. Blank or special characters separate words in a SAS statement.
TIP You can specify SAS statements in uppercase or lowercase. In most situations,
text that is enclosed in quotation marks is case sensitive.
Here are two important rules for writing SAS programs:
• A SAS statement ends with a semicolon.
• A statement usually begins with a SAS keyword.
There are two types of SAS statements:
• statements that are used in DATA and PROC steps
• statements that are global in scope and can be used anywhere in a SAS program
Global Statements
Global statements are used anywhere in a SAS program and stay in effect until changed
or canceled, or until the SAS session ends. Here are some common global statements:
TITLE, LIBNAME, OPTIONS, and FOOTNOTE.
DATA Step
The DATA step creates or modifies data. Input for a DATA can include raw data or a
SAS data set. Output from a DATA step can include a SAS data set or a report. A SAS
data set is a data file that is formatted in a way that SAS can understand.
For example, you can use DATA steps to do the following:
• put your data into a SAS data set
• compute values
The Basics of the SAS Language 7
PROC Step
The PROC step analyzes data, produces output, or manages SAS files. The input for a
PROC (procedure) step is usually a SAS data set. Output from a PROC step can include
a report or an updated SAS data set.
For example, you can use PROC steps to do the following:
• create a report that lists the data
• analyze data
• create a summary report
• produce plots and charts
1 The TITLE statement is a global statement. Global statements are typically outside
steps and do not require a RUN statement.
2 The DATA step creates a new SAS data set named Work.JuneFee. The SET
statement reads in the data from Cert.AdmitJune. The new data set contains only
those observations whose value for Age is greater than 39.
3 If a RUN or QUIT statement is not used at the end of a step, SAS assumes that the
beginning of a new step implies the end of the previous step. If a RUN or QUIT
statement is not used at the end of the last step in a program, SAS Studio and SAS
Enterprise Guide automatically submit a RUN and QUIT statement after the
submitted code.
4 The PROC PRINT step prints a listing of the new SAS data set. A PROC step begins
with a PROC statement, which begins with the keyword PROC.
8 Chapter 2 • Basic Concepts
When a SAS program is submitted for execution, SAS first validates the syntax and then
compiles the statements. DATA and PROC statements signal the beginning of a new
step. The beginning of a new step also implies the end of the previous step. At a step
boundary, SAS executes any statement that has not been previously executed and ends
the step.
Example Code 2 Processing SAS Programs
data work.admit2; /* #1 */
set cert.admit;
where age>39;
proc print data=work.admit2; /* #2 */
run; /* #3 */
1 The DATA step creates a new SAS data set named Work.Admit2 by reading
Cert.Admit. The DATA statement is the beginning of the new step. The SET
statement is used to read data. The WHERE statement conditionally reads only the
observations where the value of the variable Age is greater than 39.
2 The PROC PRINT step prints the new SAS data set named Work.Admit2. The
PROC PRINT statement serves as a step boundary in this example because a RUN
statement was not used at the end of the DATA step. The PROC step also implies the
end of the DATA step.
3 The RUN statement ends the PROC step.
TIP The RUN statement is not required between steps in a SAS program. However, it
is a best practice to use a RUN statement because it can make the SAS program
easier to read and the SAS log easier to understand when debugging.
The Basics of the SAS Language 9
Log Messages
The SAS log collects messages about the processing of SAS programs and about any
errors that occur. Each time a step is executed, SAS generates a log of the processing
activities and the results of the processing.
When SAS processes the sample program, it produces the log messages shown below.
Notice that you get separate sets of messages for each step in the program.
5 data work.admit2;
6 set cert.admit;
7 where age>39;
8 run;
NOTE: There were 10 observations read from the data set CERT.ADMIT.
WHERE age>39;
NOTE: The data set WORK.ADMIT2 has 10 observations and 9 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
NOTE: There were 10 observations read from the data set WORK.ADMIT2.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.35 seconds
cpu time 0.24 seconds
Results of Processing
When the program is processed, it creates a new SAS data set, Work.Admit2, containing
only those observations with age values greater than 39. The DATA step creates a new
data set and produces messages in the SAS log, but it does not create a report or other
output.
KISSA. Minä tiedän, äiti Yö, minä tiedän, että ajat ovat kovat, ja
me olemme melkein yksin jälellä taistelemassa Ihmistä vastaan…
Kuulen heidän tulevan… On olemassa vain yksi keino… Kun he ovat
lapsia, on heidät pelotettava niin, etteivät uskalla pitää kiinni
vaatimuksestaan eivätkä avata suurta peräovea, jonka takana Kuun
linnut ovat… Toisten luolien salaisuudet riittävät johtamaan heidän
huomionsa toisaalle tai saattamaan heidät kauhun valtaan…
TILTIL. Miksi?
TILTIL. Niin, juuri sitä varten tulimme, rouva hyvä… Olkaa hyvä ja
sanokaa minulle, missä se on…
YÖ. Sitä en tiedä… En voi sanoa mitään muuta kuin että täällä se
ei ole… En ole koskaan sitä nähnyt…
TILTIL. Kyllä se on täällä… Valo sanoi minulle, että se on täällä; ja
hän tietää, mitä hän sanoo… Olkaa hyvä ja antakaa minulle
avaimenne…
TILTIL. Teillä ei ole oikeutta salata niitä Ihmiseltä, kun hän tahtoo
ne nähdä… minä tiedän sen…
TILTIL. Valo….
YÖ. Kysykää…
YÖ. Minä luulen, että siellä ovat Aaveet… On hyvin pitkä aika siitä,
kun olen sitä ovea avannut ja kun he ovat olleet ulkona…
YÖ. Pian, pian!… Ovi kiinni!… Jos ne pääsevät karkuun, emme voi
mitenkään saada heitä kiinni… Heidän aikansa käy siellä pitkäksi,
kun Ihminen ei enää heihin usko… (Hän ajaa takaa Aaveita, koettaen
saada heitä käärmepiiskalla pakoitetuksi takaisin vankilaan.)
Auttakaa minua!… Tulkaa tänne!… Tulkaa tänne!…
YÖ. Mitä se nyt hyödyttää? Johan sanoin, ettei Sininen Lintu ole
täällä… Vaan tee, niinkuin tahdot… Avaa vain, jos se sinua huvittaa…
Siellä ovat taudit…
TILTIL. Sininen Lintu ei ole siellä… Taudit siellä ovat todella hyvin
sairaan näköisiä… Eivät edes nostaneet päätään… (Muuan pikku
Tauti, jolla on tohvelit jalassa, yllään aamunuttu ja päässään
yömyssy, pääsee pujahtamaan ulos ja alkaa harppailla salissa). Kas
tuota pientä, kun pääsi… Mikä se on?…
YÖ. Avaa vain, jos tahdot; sieltä päin et tarvitse pahaa pelätä…
Pakenee.
LEIPÄ pakenee, poissa suunniltaan. Odottakaa ainakin niin kauan,
että olemme ehtineet toiseen päähän salia…
KISSA. Eivät… Hän istuu tuolla tuon kuun säteen päällä… He eivät
ulottuneet, se oli liian korkealla…
Esirippu
VIIDES KUVAELMA
Metsä.
Kissa tulee.
TILTIL. Täälläkö?
MITIL. Ei, ei, minä tahdon, että hän jää… Minua pelottaa, kun
Vahti on poissa…
TILTIL. Niin.
KOIRA. Hyvä, hyvä. Minä menen… Mutta minä tulen, kun minua
tarvitset…
TILTIL. Mitä tämä on?… Mitä hän aikoo?… Alan kohta saada
tarpeekseni… Koska hänellä on Sininen lintu, niin antakoon hän sen
ja heti…
KISSA. Sonni…
KUUSI. Oli…
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookluna.com