
- 208 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
eBook - ePub
About this book
Aimed at researchers and students, SAS Programming: The One-Day Course provides an introduction to the SAS programming language. It gives the reader a start in SAS programming and the basic data manipulations and statistical summaries that are available through SAS. The book has its origins in material prepared by the author for a one-day course i
Frequently asked questions
Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn more here.
Perlego offers two plans: Essential and Complete
- Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
- Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, weâve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere â even offline. Perfect for commutes or when youâre on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access SAS Programming by Neil H. Spencer in PDF and/or ePUB format, as well as other popular books in Mathematics & Probability & Statistics. We have over one million books available in our catalogue for you to explore.
Information
1
Introducing SAS
SAS is a powerful computer package used for the analysis of data. It is made up of various modules that contain PROCEDURES to undertake specific tasks. The BASE module contains the basics of the SAS system, including data entry and manipulation and simple statistical operations. Purchasers of SAS can then decide what additional modules they require. Examples include the SAS/GRAPH module for graphics, the SAS/IML module (Interactive Matrix Language), and the SAS/STAT module for more advanced statistical operations. There is also a SAS/ASSIST module that allows the user to interact with the system directly, in a similar manner as to many other statistical software packages. It does not, however, use MicrosoftÂŽ WindowsÂŽ dialogue boxes that users might expect, and it is much less user friendly than other packages in this regard.
Unless SAS/ASSIST or some other interactive system is being used, the package is operated by the user writing a program and then submitting it to the system. The system then processes the statements and produces output, as appropriate, and a log file, giving details of what operations were carried out.
So why does SAS not have a user-friendly interface? Why does it expect its users to learn how to write programs? The answers lie in the nature of research projects: they are typically undertaken by a group of researchers and are ongoing for a significant amount of time. This means that a record must be kept of exactly what data manipulations, analyses, etc., were accomplished. Keeping programs of statements, which can contain comments on what the programs do, what revisions were made, dates on which the programs were created, and when revisions were made, is an effective tool. These programs can also contain statements that carry out many analyses and data manipulations within the same program. When revisions are made to these more complex programs, the resulting program can be simply submitted to the system, and all the analyses and data manipulations can be carried out together. To do the same using dialogue boxes may necessitate the use of many boxes and take a significant amount of operator time.
SAS is not unique in offering this ability to write programs in a command language. Many packages that use dialogue boxes simply convert the dialogue box information into their own command language for processing. Some keep this conversion hidden from the user, some show it explicitly, and others offer the option of displaying the converted commands. The capabilities of the SAS system are immense. With this book, the author does not expect readers to become expert programmers in one day but does aim to develop skills that will enable readers to use SAS to a certain level and, perhaps more importantly, put them in a position to further develop programming skills in the particular areas of application that are relevant to their work.
In the programs in this book, words that are part of the SAS programming language are given in uppercase, and words that are defined by the user (e.g., variable names and dataset names) are given in lowercase. SAS, however, is not case sensitive, and the distinction shown here is for clarity only.
1.1
OPERATING SAS
How the user interacts with SAS depends to a large extent on the operating system that is being used. It is not the intention of this book to document in detail the vagaries of using SAS with every possible operating systemâits aim is to introduce the programming language. However, some features are common to all systems (in one form or another) and are discussed below. Throughout the rest of the book, efforts are made to avoid detail specific to any particular operating system. The only exception is when the author has judged that mention of features found in the widespread Microsoft Windows operating sys tem is worthwhile (e.g., Section 1.2). When external files are accessed in programs, MS-DOS paths are used.
1.1.1
WRITING AND SUBMITTING A SAS PROGRAM
A SAS program is written in plain text, and any text editor or word processor that can save in plain text format can be used. Once complete, the program is submitted to the SAS software for processing.
For the sake of efficiency, it is a good idea to restrict individual programs to performing just a few tasks. Programs that undertake many different analyses and data manipulations can become unwieldy and difficult to understand.
1.1.2
SAS LoG
Once SAS has processed a submitted program, it displays the operations it carried out in a log file, which displays the submitted program in sections with âNotes,â âWarnings,â and âErrors.â Notes are good, warnings are potentially worrisome, and errors tell the user why the program failed. As with any computer program, it is unusual for a SAS program to be written correctly the first time. An understanding of what the log window is telling the user about the program submitted is vital in debugging and is developed as a programmer gains experience.
1.1.3
SAS OUTPUT
If the submitted program creates any nongraphical viewable output (i.e., analysis results or tables), then it will be displayed by default in an output file. Graphical output will be produced in a format appropriate to the operating system being used. If the Output Delivery System (discussed in Section 8.1) is used, other files may result.
1.2
OPERATING SAS WITH MICROSOFT WINDOWS
In Version 8 of the Microsoft Windows version of SAS, there is an âEnhanced Program Editorâ window, which is where the SAS program resides. When this window is active (has a coloured bar at the top rather than a grey bar), the menu bar at the top of the screen is particular to the Program Editor, and the toolbar buttons will also operate in the window. There are facilities for opening, closing, and saving programs as well as cutting, copying, and pasting. It operates simply as a text editor. An advantage of using the SAS Enhanced Program Editor over other plain text editors is that it automatically colour codes different parts of the program and displays horizontal lines dividing separate parts of the program. This is a valuable aid when writing a program, as when errors in programming syntax are made, the user does not see the expected colour patterns and thus knows that something is wrong. On the toolbar, there is a button that is selected to run the program. The program can also be run via the menu bar: âRunâ, âSubmitâ.
1.2.1
OTHER WINDOWS
The âOutputâ window is where the results of the program are shown by default. There is also an accompanying âResultsâ window that lists the output produced in folder-like forms. SAS organises its output into âpagesâ. The number of lines that can be fitted onto a page and the maximum length of these lines can be customised by using âToolsâ, âOptionsâ, âSystemâŚâ and then, within the âLog and procedure output controlâ folder, selecting âSAS log and procedure outputâ. The option that the user wishes to change is then selected. When the Output window is printed directly from SAS, each new page in SAS requires a fresh sheet of paper. It is frequently the case that a page of SAS output contains only a few lines.
The âLogâ window is important when there are errors in the program that was written. It displays the submitted program in sections with colour-coded âNotesâ, âWarningsâ, and âErrorsâ.
If graphs are produced by SAS as a result of a program running, they open in separate windows.
1.2.2
CLEARING TEXT FROM WINDOWS
When an SAS program is run, edited, and rerun successively until a correctly working program is obtained, a lot of redundant text will accumulate in the Log window and potentially in the Output window.
Thus, it is often a good idea to clear all the text from a window before submitting the program. The text that then appears in the Log window must be relevant to the program just submitted, and debugging can take place if necessary. It can also be confusing to have irrelevant text in the Output window, so once a correctly operating program is obtained, it is a good idea to run it again after clearing all previous text from the Output window.
2
Reading Data into SAS
Unlike many statistical packages, SAS can operate with several datasets at one time. Some of the flexibility that this offers will be investigated later, but the first step in any analysis has to be to access the data. The issue of permanent SAS datasets will also be addressed later, but the first issue addressed is that of how data can be taken into SAS from a plain text file as part of a SAS program that may also contain statements to carry out analyses on the data. Using PROC IMPORT, SAS can also import data from a delimited plain text file and data that were previo...
Table of contents
- COVER PAGE
- TITLE PAGE
- COPYRIGHT PAGE
- PREFACE
- AUTHOR
- 1. INTRODUCING SAS
- 2. READING DATA INTO SAS
- 3. SAVING AND OUTPUT OF SAS DATASETS
- 4. MANIPULATING DATASETS
- 5. RESTRUCTURING DATASETS
- 6. SUMMARISING DATA
- 7. TABULATING DATA
- 8. FORMATTING AND SAVING SAS OUTPUT
- 9. GRAPHICS IN SAS
- 10. AN INTRODUCTION TO MACROS
- APPENDIX A: NURSESâ GLOVE USE DATA
- APPENDIX B: LOS ANGELES DEPRESSION DATA
- APPENDIX C: SOLUTION PROGRAMS FOR TASKS