(Original PDF) SAS Certification Prep Guide Base Programming for SAS9, Fourth Edition download
(Original PDF) SAS Certification Prep Guide Base Programming for SAS9, Fourth Edition download
https://ebookluna.com/product/original-pdf-sas-certification-
prep-guide-base-programming-for-sas9-fourth-edition/
(eBook PDF) SAS Certified Specialist Prep Guide: Base Programming Using SAS
9.4
https://ebookluna.com/product/ebook-pdf-sas-certified-specialist-prep-
guide-base-programming-using-sas-9-4/
(eBook PDF) Business Analytics Using SAS Enterprise Guide and SAS
Enterprise Miner
https://ebookluna.com/product/ebook-pdf-business-analytics-using-sas-
enterprise-guide-and-sas-enterprise-miner/
Prepare Your Data for Tableau: A Practical Guide to the Tableau Data Prep
Tool (eBook PDF)
https://ebookluna.com/product/prepare-your-data-for-tableau-a-practical-
guide-to-the-tableau-data-prep-tool-ebook-pdf/
(eBook PDF) SSAT Lower Level Prep Book: Study Guide & Practice Test
Questions for the SSAT Elementary Level Test
https://ebookluna.com/product/ebook-pdf-ssat-lower-level-prep-book-study-
guide-practice-test-questions-for-the-ssat-elementary-level-test/
Bicycling for Transportation: An Evidence-Base for Communities 1st edition-
eBook PDF
https://ebookluna.com/download/bicycling-for-transportation-an-evidence-
base-for-communities-ebook-pdf/
https://ebookluna.com/product/ebook-pdf-pediatric-nurse-practitioner-
certification-review-guide-6th-edition/
https://ebookluna.com/product/ebook-pdf-lpic-1-linux-professional-
institute-certification-study-guide-4th-edition/
https://ebookluna.com/product/ebook-pdf-midwifery-womens-health-nurse-
practitioner-certification-review-guide-4th-edition/
(eBook PDF) Linux+ and LPIC-1 Guide to Linux Certification 5th Edition
https://ebookluna.com/product/ebook-pdf-linux-and-lpic-1-guide-to-linux-
certification-5th-edition/
SAS Certification Prep
®
SAS® Documentation
December 6, 2017
viii Contents
ix
Requirements
To complete examples in this book, you must have access to Base SAS, SAS Enterprise
Guide, or SAS Studio. See Chapter 1, “Setting Up Practice Data,” to ensure you have
proper access.
On the Web
Bookstore www.sas.com/books
Certification www.sas.com/certify
Community 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
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.
xii How to Prepare for the SAS Base Programming for SAS®9 Exam
xiii
Overview
The SAS Certification Prep Guide: Base Programming 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.
xiv Accessibility Features of the SAS Certification Prep Guide
1
Chapter 1
If the result from the OPTIONS procedure code is NORSASUSER, the Sasuser folder is
writable.
If the result from the PROC OPTIONS code is RSASUSER, the Sasuser folder is Read
only, and you must redirect the Sasuser folder by using a LIBNAME statement. To set
up practice data:
1. In the Folders pane, select My Folders. Then, right-click and select New ð Folder.
2 Chapter 1 • Setting Up Practice Data
2. In the Name box, enter a folder name. This example uses the name certprep.
Click Save.
3. Redirect your SASUSER library to the new folder as follows:
If you are using SAS University Edition, submit a LIBNAME statement by copying
the following code into the Code tab:
libname sasuser "/folders/myfolders/certprep";
Note: You must use the filename of the new directory. These examples use the name
certprep. If you use another filename, substitute the name that you created.
4. Click Run.
5. Save the program as libname_cert.sas. You must resubmit this LIBNAME statement
program every time you work with the sample data.
6. Copy the sample data program into a new Code window in SAS Studio. You can
access the sample data at http://support.sas.com/publishing/cert/sampdata.txt.
7. Click Run.
Now that the sample data is stored in a permanent directory, reissue the LIBNAME
statement whenever you want to use the data.
5. If the result from the PROC OPTIONS code is RSASUSER, you must redirect the
Sasuser folder by creating a new folder. From your server area, open the Files folder,
right-click a drive or folder, and select New Folder. Enter the new folder name.
Note: If the result from the PROC OPTIONS code is NORSASUSER, the Sasuser
folder is writable, and you do not have to redirect the Sasuser folder. Therefore,
you can skip this step and the next one.
6. Submit the following code in a Code window:
libname sasuser "/folders/myfolders/certprep";
Note: You must use the filename of the new folder. These examples use the name
certprep. If you use another filename, substitute the folder name that you
created for certprep.
7. Copy the sample data program into the Program window and then run the program.
You can access the sample data at http://support.sas.com/publishing/cert/
sampdata.txt.
8. Because you do not need these shortcuts, delete the Program item and all the
shortcuts from the project. This action does not delete the data that you created. To
delete the item from the project, right-click Program and select Delete.
9. In the Confirmation window, click Yes.
4 Chapter 1 • Setting Up Practice Data
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
A Simple SAS Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Processing SAS Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Log Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Rules for SAS Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
SAS Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Overview of Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Descriptor Portion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Data Portion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Variable Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Variable Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Informat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
SAS Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Extended Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Chapter Quiz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6 Chapter 2 • Basic Concepts
Getting Started
In the SAS Base Programming for SAS®9 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 on the windows and menus of the SAS windowing
environment, 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. The input for a DATA step can be of several
types, such as raw data or a SAS data set. The output from a DATA step can be of
several types, such as 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
The Basics of the SAS Language 7
• compute values
• check for and correct errors in your data
• produce new SAS data sets by subsetting, supersetting, merging, and updating
existing data sets
PROC Step
The PROC (procedure) step analyzes data, produces output, or manages SAS files. The
input for a PROC step is usually a SAS data set. The output from a PROC step can be of
several types, such as 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
• produce descriptive statistics
• create a summary report
• produce plots and charts
data sasuser.admit2;
set sasuser.admit;
where age>39;
run;
proc print data=sasuser.admit2;
run;
The sample SAS program contains a DATA step and a PROC step. The DATA step
produced a new SAS data set. Only those observations with an age value greater than 39
are written to the new SAS data set.
A DATA step begins with a DATA statement, which begins with the keyword DATA. A
PROC step begins with a PROC statement, which begins with the keyword PROC. The
sample program contains the following statements:
II.
Honour’s got in, and keeps her Heart;
Durst he but venture once abroad,
In my own Right I’d take your part,
And shew my self a mightier God.
III.
This huffing Honour domineers
In Breasts, where he alone has place:
But if true gen’rous Love appears,
The Hector dares not shew his Face.
IV.
Let me still languish, and complain,
Be most inhumanly deny’d:
I have some Pleasure in my Pain,
She can have none with all her Pride.
V.
I fall a Sacrifice to Love,
She lives a Wretch for Honour’s sake;
Whose Tyrant does most cruel prove,
Whose Tyrant does most cruel prove,
The Difference is not hard to make.
VI.
Consider Real Honour then,
You’ll find Hers cannot be the same,
’Tis noble Confidence in Men,
In Women mean mistrustful Shame.
Grecian KINDNESS.
A SONG.
I.
The utmost Grace the Greeks could shew,
When to the Trojans they grew kind,
Was with their Arms to let ’em go,
And leave their lingring Wives behind.
They beat the Men, and burnt the Town,
Then all the Baggage was their own.
II.
There the kind Deity of Wine
Kiss’d the soft wanton God of Love;
This clapt his Wings, that press’d his Vine,
And their best Pow’rs united move.
While each brave Greek embrac’d his Punk,
Lull’d her asleep, and then grew drunk.
The MISTRESS.
A SONG.
I.
An Age in her Embraces past,
Would seem a Winter’s Day;
Where Life and Light with envious haste,
Are torn and snatch’d away.
II.
But, oh! how slowly Minutes roul,
When absent from her Eyes;
That fed my Love, which is my Soul,
It languishes and dies.
III.
For then no more a Soul but Shade,
It mournfully does move;
And haunts my Breast, by Absence made
The living Tomb of Love.
IV.
You wiser Men despise me not;
Whose Love-sick Fancy raves,
On Shades of Souls, and Heav’n knows what;
Short Ages live in Graves.
V.
Whene’er those wounding Eyes, so full
Of Sweetness, you did see;
Had you not been profoundly dull,
Had you not been profoundly dull,
You had gone mad like me.
VI.
Nor censure us, you who perceive
My best belov’d and me,
Sigh and lament, complain and grieve,
You think we disagree.
VII.
Alas! ’tis sacred Jealousie,
Love rais’d to an Extream;
The only Proof ’twixt them and me,
We love, and do not dream.
VIII.
Fantastick Fancies fondly move;
And in frail Joys believe:
Taking false Pleasure for true Love;
But Pain can ne’er deceive.
IX.
Kind jealous Doubts, tormenting Fears,
And anxious Cares, when past;
Prove our Hearts Treasure fix’d and dear,
And make us blest at last.
A SONG.
I.
Absent from thee I languish still;
Then ask me not, When I return?
The straying Fool ’twill plainly kill,
To wish all Day, all Night to mourn.
II.
Dear, from thine Arms then let me fly,
That my fantastick Mind may prove,
The Torments it deserves to try,
That tears my fix, Heart from my Love.
III.
When wearied with a World of Woe,
To thy safe Bosom I retire,
Where Love and Peace and Truth does flow,
May I contented there expire.
IV.
Left once more wandring from that Heav’n,
I fall on some base Heart unblest;
Faithless to thee, false, unforgiven,
And lose my everlasting Rest.
To CORINNA.
A SONG.
I.
What cruel Pains Corinna takes,
To force that harmless Frown:
When not one Charm her Face forsakes,
Love cannot lose his own.
II.
So sweet a Face, so soft a Heart,
Such Eyes so very kind,
Betray, alas! the silly Art
Virtue had ill design’d.
III.
Poor feeble Tyrant! who in vain
Would proudly take upon her,
Against kind Nature to maintain
Affected Rules of Honour.
IV.
The Scorn she bears so helpless proves,
When I plead Passion to her,
That much she fears, (but more she loves,)
Her Vassal should undo her.
A young Lady to her ancient Lover.
A SONG.
I.
Ancient Person, for whom I
All the flatt’ring Youth defie;
Long be it e’re thou grow old,
Aking, shaking, crasie, cold.
But still continue as thou art,
Ancient Person of my Heart.
II.
On thy withered Lips and dry,
Which like barren Furrows lie;
Brooding Kisses I will pour,
Shall thy youthful Heart restore.
Such Kind Show’rs in Autumn fall,
And a second Spring recal:
Nor from thee will ever part,
Ancient Person of my Heart.
III.
Thy nobler Part, which but to name,
In our Sex wou’d be counted Shame,
By Ages frozen grasp possess’d
From their Ice shall be releas’d:
And, sooth’d by my reviving Hand,
In former Warmth and Vigour stand.
All a Lover’s Wish can reach,
For thy Joy my Love shall teach:
And for thy Pleasure shall improve
All that Art can add to Love,
Yet still I love thee without Art,
Ancient Person of my Heart
Ancient Person of my Heart.
To a LADY:
IN A
LETTER.
A SONG.
I.
Such perfect Bliss, fair Chloris, we
In our Enjoyment prove:
’Tis pity restless Jealousie
Should mingle with our Love.
II.
Let us, since Wit has taught us how,
Raise Pleasure to the top:
You rival Bottle must allow,
I’ll suffer rival Fop.
III.
Think not in this that I design
A Treason ’gainst Love’s Charms,
When following the God of Wine,
I leave my Chloris Arms.
IV.
Since you have that, for all your Haste,
At which I’ll ne’er repine,
Its Pleasure can repeat as fast,
As I the Joys of Wine.
V.
There’s not a brisk insipid Spark,
That flutters in the Town:
But with your wanton Eyes you mark
But with your wanton Eyes you mark
Him out to be your own.
VI.
Nor do you think it worth your Care,
How empty, and how dull,
The Head of your Admirers are,
So that their Veins be full.
VII.
All this you freely may confess,
Yet we ne’er disagree:
For did you love your Pleasure less,
You were no Match for me.
The FALL.
A SONG.
I.
How blest was the Created State
Of Man and Woman e’re they fell,
Compar’d to our unhappy Fate,
We need not fear another Hell!
II.
Naked, beneath cool Shades, they lay,
Enjoyment waited on Desire:
Each Member did their Wills obey,
Nor could a Wish set Pleasure higher.
III.
But we, poor Slaves, to Hope and Fear,
Are never of our Joys secure;
They lessen still, as they draw near,
And none but dull Delights endure.
IV.
Then, Chloris, while I Duty pay,
The nobler Tribute of my Heart,
Be not you so severe to say,
You love me for a frailer Part.
LOVE and LIFE.
A SONG.
I.
All my past Life is mine no more,
The flying Hours are gone:
Like transitory Dreams giv’n o’er,
Whose Images are kept in store,
By Memory alone.
II.
The Time that is to come is not;
How can it then be mine?
The present Moment’s all my Lot;
And that, as fast as it is got,
Phillis, is only thine.
III.
Then talk not of Inconstancy,
False Hearts, and broken Vows;
If I, by Miracle, can be
This live-long Minute true to thee,
’Tis all that Heav’n allows.
A SONG.
I.
While on those lovely Looks I gaze,
To see a Wretch pursuing;
In Raptures of a blest Amaze,
His pleasing happy Ruin;
’Tis not for pity that I move;
His Fate is to aspiring,
Whose Heart, broke with a Load of Love,
Dies wishing and admiring.
II.
But if this Murder you’d forego,
Your Slave from Death removing;
Let me your Art of Charming know,
Or learn you mine of loving.
But whether Life, or Death, betide,
In Love it’s equal Measure,
The Victor lives with empty Pride;
The Vanquish’d die with Pleasure.
A SONG.
I.
Love a Woman! you’re an Ass,
’Tis a most insipid Passion;
To chuse out for your Happiness,
The silliest Part of God’s Creation.
II.
Let the Porter, and the Groom,
Things design’d for dirty Slaves;
Drudge in fair Aurelia’s Womb,
To get Supplies for Age and Graves.
III.
Farewel, Woman, I intend,
Henceforth, ev’ry Night to sit
With my lewd well-natur’d Friend,
Drinking to engender Wit.
A SONG.
I.
To this moment a Rebel, I throw down my Arms,
Great Love, at first Sight of Olinda’s bright Charms:
Made proud, and secure by such Forces as these,
You may now play the Tyrant as soon as you please.
II.
When Innocence, Beauty, and Wit do conspire,
To betray, and engage, and inflame my Desire,
Why should I decline what I cannot avoid,
And let pleasing Hope by base Fear be destroy’d?
III.
Her Innocence cannot contrive to undo me,
Her Beauty’s inclin’d, or why shou’d it pursue me?
And Wit has to Pleasure been ever a Friend,
Then what room for Despair since Delight is Love’s End.
IV.
There can be no danger in Sweetness and Youth,
Where Love is secur’d by Good-nature and Truth:
On her Beauty I’ll gaze, and of Pleasure complain;
While every kind Look adds a Link to my Chain.
V.
’Tis more to maintain, than it was to surprize,
But her Wit leads in Triumph the Slave of her Eyes:
I beheld, with the Loss of my Freedom before,
I beheld, with the Loss of my Freedom before,
But hearing, for ever must serve and adore.
VI.
Too bright is my Goddess, her Temple too weak:
Retire, Divine Image! I feel my Heart break.
Help, Love, I dissolve in a Rapture of Charms;
At the thought of those Joys I shou’d meet in her Arms.
Upon his leaving his
MISTRESS.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
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