8323 Stats - Lesson 1 - 02 SAS Introduction

Category: Education

Presentation Description

8323 Stats - Lesson 1 - 02 SAS Introduction


Presentation Transcript



Introduction to SAS: 

Introduction to SAS SAS is a powerful statistical software designed to support Business Intelligence. SAS communicates with you, and you communicate with SAS through a system of Windows. Main programming windows There are three main programming widows. EDITOR: In the editor window you write your SAS programs, i.e., the procedures you want to apply to your data. SAS procedures are a collection of statements. LOG: The log window gives to you information about programs you submitted to SAS. In particular, you should always have a look to this window where you can find the statements you submitted. In this windows three kind of messages are displayed: NOTES (blue): give to you information about your elaboration. ERRORS (red): tell you that some error occurred while elaborating your program, and that this error can not be managed by SAS. Your program statements have to be changed in order to remove the problem. WARNINGS (green): tell you that your program may contain some errors. Nevertheless, SAS “understood” which error occurred and tells you how it managed the error itself. You have to check if the correction made by SAS is satisfactory. OUTPUT: The output window displays the required output.

Introduction to SAS: 

Introduction to SAS Navigation windows Two more windows are available to have an easier access to your input and to your output. EXPLORER: In this window you find information about SAS libraries (see later). From this window you can open SAS data set . RESULT: This window permits to you to quickly navigate your output. Moreover, you can use this window to obtain the output in a format which can be easily exported in Excel and in Word (see later).

Introduction to SAS: 

Introduction to SAS Below a description of the main steps of a SAS section is reported

Introduction to SAS – Accessing SAS datasets: 

Introduction to SAS – Accessing SAS datasets SAS only elaborates data matrices in a SAS format. Managing SAS datasets. To access an already existing SAS dataset, you have to indicate to SAS where (which directory on yr PC) it is located. Directories on your PC can not be directly accessed from SAS. A SAS library is a “name” assigned (during a session) to one directory in your PC. Hence, when your session starts, you have to specify which directories in yr PC (possibly) contain data you are going to use, by declaring the libraries. Assigning a library The simplest way to assign a library consists in clicking on the New Library button on the main menu

Introduction to SAS – Permanent and work libraries: 

Introduction to SAS – Permanent and work libraries Managing SAS datasets. A data set in a given directory can be accessed by specifying its name and its directory: libname.dataname Work and permanent SAS datasets. A data set created during one SAS session will by default be stored in a work library, which will be erased at the end of the session. If you want to save your SAS dataset you have to specify the library (directory on yr PC) where you want yr data to be saved. Hence A data set referred to as dataname Will be lost at the end of the session A data set referred to as libname.dataname Will be saved at the end of the session

Introduction to SAS – Importing External data : 

Introduction to SAS – Importing External data Importing data from external sources It is possible to import data in other formats. At this aim you can use the Import Wizard. From any SAS window, you can open the File menu in the main menu bar and you can select Import Data. The imported dataset can be saved in the work library or in a permanent library

Introduction to SAS – SAS programs: 

Introduction to SAS – SAS programs SAS programs are constituted by two fundamental steps. DATA Step: This step is used to manipulate data, transform variables and, also, to modify the structure of datasets. PROC Step: This step is used to elaborate SAS dataset, i.e. to analyze data, to create reports, to obtain graphs. As it was said before, SAS programs must be written in the Editor Window. Data and Proc Steps are collection of statements. The first statement contains a starting declaration key (DATA or PROC) indicating whether the procedure consists in a data or in a proc step. Also the other statements start with an identification key [in blue] identifying the elaboration required. ALL SAS statement must end with a semicolon “ ; ”. Each data or proc step ends with a “ run; ” statement, indicating that no more elaboration are required in a particular step of analysis. If a word in a statement is emphasized in red this means that the statement is wrong. Comments may be inserted, and have to be preceded by a “ /* ” and followed by a “ */ ”. Comments are emphasized in /* green */. A quoted text, ‘Text’ (within quotation marks), is emphasized in violet. Take care: Quotation marks must always be closed.

authorStream Live Help