SAS Programming 1 - SAS Programming caite.info - Ebook download as PDF File .pdf), Text File .txt) or read book online. SAS® Programming 1: Essentials Course Notes was developed by Michele Ensor Demonstration: Creating HTML, PDF, and RTF Files. The course builds on the concepts that are presented in the SAS Programming 1: Essentials course and is not recommended for beginning SAS software users.
|Language:||English, Spanish, French|
|Genre:||Academic & Education|
|ePub File Size:||25.69 MB|
|PDF File Size:||9.61 MB|
|Distribution:||Free* [*Regsitration Required]|
SAS Programming I: Essentials Course Notes SAS® Programming I: Essentials PROG1_ ISBN For Your Information iii Table of Contents caite.info caite.info files cannot be displayed on the UNIX platform because no. It is the entry point to learning SAS programming for data science, machine you should attend the SAS® Enterprise Guide® 1: Querying and Reporting course. export data and results to Excel, PDF, and other formats; use SQL in SAS to. This course is for users who want to learn how to write SAS® programs. It is the entry point to learning SAS programming and is a prerequisite to many other.
Chapter 8 Validating and Cleaning Data 8. The infile 'newemps. Invalid data for JobCode in line 7 Blank Concatenate table information. Reinitialize rest of PDV to missing Fill in the blank with the location of your SAS data library. Insert SAS comments using two methods.
Enlarge cover. Error rating book. Refresh and try again.
Open Preview See a Problem? Details if other: Thanks for telling us about the problem. Return to Book Page. SAS Programming 1: Get A Copy. Paperback , 0 pages. More Details Friend Reviews. To see what your friends thought of this book, please sign up. To ask other readers questions about SAS Programming 1 , please sign up.
Lists with This Book. This book is not yet featured on Listopia. Community Reviews. Showing Rating details. Sort order. John rated it really liked it Jul 25, Carmen rated it really liked it Sep 26, Gaurav Paliwal rated it it was amazing Mar 09, Srikanth rated it it was amazing Jul 27, Radha Sharma rated it it was ok May 08, Ivan rated it really liked it May 16, Karen Bilo rated it really liked it Aug 15, Gintare rated it really liked it Dec 31, Richard Poon rated it it was amazing Oct 03, Brisa rated it it was amazing Sep 19, Hector Cobo rated it really liked it May 25, David Chicoine marked it as to-read Jul 02, After the program executes.
The Log window contains the programming statements that were recently submitted. If you want this every time that you invoke SAS. Using the Help Facility 1. This demo is based on Enterprise Guide 4. Examine the results.
The program is included in the Program tab of the workspace area. M a Program tab or select the F8 key. To change the result format. Resubmit the program. View the multiple Results tabs to view the different result formats.
Select Yes to replace the results from the previous run. To scroll vertically in the Log tab. In this example.
To add a new program to the existing project.
SAS Enterprise Guide uses projects to manage each collection of related data. Multiple programs can be added to one project. Submit the program and review the results. To save the program. To save the project.
To maneuver between programs. To delete a program. Clear the Log and Output windows. Examine the Log window. Based on the log notes.
Identifying SAS Components a. With the appropriate Editor window active. Based on the report in the Output window. Submit the program for execution. In the Help facility. Press the F12 key and confirm that the Log and Output windows are cleared. From a Web browser. Windows Select File Open Program and select the pe On the Contents tab. Close the KEYS window. Add the following commands to the F12 key: Setting Up Function Keys ia l t e r a.
Select Base SAS. S No tsi b. In which modes can you run a SAS program? How can you submit a program in the SAS windowing r y i o n 5. What are the two components of a SAS program?
What are the three primary windows in the SAS a windowing environment? How can you include a program in the SAS windowing environment? Type the following SAS program: Submitting a Program and Using the Help Facility a. Submit the program. Include a SAS program. Issue the KEYS command. Add a command to the F12 key. M n format Salary dollar Setting Up Function Keys P r a. Press the F12 key. Customize the appearance and functionality of the Enhanced Editor.
Partial Documentation ou. Step run. How can you submit a program in the SAS windowing t a environment? File Open. Run Submit. What are the three primary windows in the SAS S f o r o windowing environment? A step is a sequence of SAS statements. PROC var Salary. PROC run. S o o data work. Insert SAS comments using two methods. Explain SAS syntax rules. Several statements can be on the same line.
A S No tsit d e They can begin and end in any column. A single statement can span multiple lines. S f o r o One or more blanks or special characters can be used to separate words.
A t f e Several statements can be on the same line. S P o r o f They can begin and end in any column. M run. They can begin and end in any column. One or more blanks or special characters can be used to separate words. S No tsi d data work. You can use comments anywhere in a SAS program to document the purpose of the program. Two methods of commenting: On some operating environments. Diagnose and correct a program with errors.
Save the corrected program. NewSalesEmps run. Examples of syntax errors: NewSalesEmps average max. Syntax error. SAS prints a a warning or an error message to the log. The SAS log contains error messages and warnings. Assuming the symbol DATA was misspelled as daat.
Pvar Salary. ERROR The option or parameter is not recognized and will be ignored. The original program is copied into the Program Editor. The SAS System stopped processing this step because of errors. If you are using the Enhanced Editor.
NewSalesEmps 45 run. If the code is not in the Program Editor. Edit the program. NewSalesEmps mean max. S o o recall your program before saving the program. Correct the spelling of DATA. It runs successfully without errors and generates output.
To correct the problem in the Windows environment. Both single quotation marks and double quotation marks are r t i used in case you submitted double quotation marks instead of single quotation marks. SAS reads the quotation mark in the code above as the matching quotation mark in the quotation n mark counter. SAS then has an even number of quotation marks in the quotation mark counter and runs y o successfully.
Select 1. The banner in the window indicates that the DATA step is still running. To correct the problem in the UNIX operating environment. Session Management window and select Interrupt. Select Y. Select 1 in the SAS: Tasking Manager window. Select Y to cancel submitted statements. When you make changes to the program in the Enhanced Editor and did not save the new version of the program. When you save the program.
A run. Type 1 to select 1. In the appropriate Editor window. Level 3 ou 3. Types of Errors in SAS. In the Topics Found pop-up box. Correct the error and resubmit the program. Double-click syntax errors in the results box. Diagnosing and Correcting a Missing Statement i e i b a. Name the five types of errors.
Are there any errors in the SAS log? Notice the message in the title bar of the Editor window. Use the notes in the SAS log to identify the error. Confirm that the output was created for the program by viewing the Log and Output windows. Diagnosing and Correcting a Misspelled Word a. Submit the added statement. What are two methods of commenting?
With what do SAS statements always end? With what do SAS statements usually begin? How do you save a program? Name four types of syntax errors. Notice the message in the title bar. Include the SAS program.
Add the missing statement. Diagnosing and Correcting a Missing Statement r a. S No tsi f. Confirm that the output was created. Correct the error. Select Error Processing and Debugging: Type of Errors in SAS.
What are the errors? Issue the FILE command. Name four types of syntax errors.. Select File Save As. A SAS data set is a specially structured file that contains data values. Identify a missing value and a SAS date value. Define a SAS variable. S o o Partial Work. State the naming conventions for SAS data sets ia l and variables.. Feb S No tsi Example: Retrieve program pa Jan After the DATA step. Stored as floating point numbers ou in 8 bytes of storage by default. Eight bytes of floating point storage numeric provide space for 16 or 17 significant digits.
Character values are stored with A S No tsit d a length of 1 to Partial Work. II Numeric M a values 11 y o n The data values are organized as a table of observations rows and variables columns. One byte equals one character. S f o e character o special characters. You are not restricted to 8 digits. SAS can read either two. SAS can perform calculations on dates starting from A.
If SAS encounters a two-digit year. P r f Partial Work. View the output to retrieve the current date as a numeric value referencing January 1. Submit program pa S t Example: Subsequent characters can be letters.
FiveMonthsData P r f By default. M a The terminology of table. S f o r o all observations e all variables A S No tsit d an Obs column on the left side 28 ou. II I 15 Leonid Karavdic Sales Rep. VAR variable s. NewSalesEmps noobs. P r run. Examining the Data Portion ia l t e r a. Retrieve the starter program pe M a all variables.
Luna sastreria S. Examining the Descriptor and Data Portions a. Top Sports Luna sastreria S. Miller Trading Inc ou. Submit the program and answer the following questions: Working with Times and Datetimes a. Use the Help facility to find documentation on how times and datetimes are stored in SAS. Complete the following sentences: Retrieve and submit the starter program pe A SAS data library s: State the difference between a permanent library ia l r and a temporary library.
Files ia l t e r Libraries M a 38 r y i o n t a u t r i e Assigning a Libref r i b S p t Regardless of which host operating system you use. SAS automatically creates one temporary and at least one permanent SAS data library that you can access. SAS can only make an association between a libref and i an existing directory.
The remaining characters must be letters. Rules for naming a libref: Windows d e libname orion 's: M n or underscores. Work ia l t Sales e r Sasuser M a The second name filename n refers to the file in the library. The first name libref refers to the library. As you open folders. In the SAS Explorer. M a 51 r y i o n t a u t If you are using a noninteractive or batch SAS session. The NODS option suppresses the descriptor portions ia l of the data sets.
Check the log to confirm that the orion libref was assigned. M a NOTE: V9 Physical Name: Retrieve and submit the program pd Double-click Libraries to show all available libraries. Double-click on the Orion library to show all members of that library.
Right-click on the Sales data set and select Properties. You can request specific information about the columns in the data table by selecting the Columns tab at the top of the Properties window.
Double-click on the Sales data set or right-click on the file and select Open. S No tsi create data sets. Select to close the Properties window. Display variable names instead of variable labels by selecting View Column Names. A view of orion. With the Explorer window active. With the SAS Explorer active. Type end to close the SAS Explorer. Select OK to close the Properties window. Fill in the blank with the location of your SAS data library. Do not display r the descriptor portions of the individual data sets.
Check the log to confirm that the SAS data library was assigned. Reviewing Concepts a. By default. SAS statements usually begin with a n. Character variable values can be up to characters long and use byte s of storage per character.
Use the SAS Explorer window to view the contents of the orion library. Every SAS statement ends with a. The internally stored SAS date value for January 3. True or False: If a SAS program produces output. There are two methods for commenting in a SAS program. Answer the following questions: What argument disassociates one or more currently assigned librefs? What are the three primary windows in the SAS windowing environment?
What are the two kinds of steps? Work is the implied libref. A SAS variable name has to characters and begins with a or an. What are the two types of variables? A library reference name libref references a particular data set. If a data set is referenced with a one level name. Omitting a semicolon never causes errors. A missing numeric value is displayed as a.
What are the two portions of every SAS data set? When a SAS session starts. A missing character value is displayed as a. Reference a relational database table using a SAS two-level name. The engine name is required. See your database administrator to determine P f the databases that are set up in your operating environment. If A S No tsit d e this option is omitted. If the user name contains blanks or national characters.
Disassociating the libref disconnects the database engine from the database and closes any resources that are associated with that libref's connection.
What window enables you to interactively browse a i e t SAS data set? What can you do with the SAS Explorer? P run. Retrieve the starter program. Examining the Data Portion a. A S No tsit d e How many observations are in the data set? SAS automatically creates the temporary library called Work. Reviewing Concepts S No tsi d a. A SAS variable name has 1 to 32 characters and begins with a letter or an underscore. SAS statements usually begin with an identifying keyword.
Character variable values can be up to Retrieve and submit the starter program. Every SAS statement ends with a semicolon. A libref name must be 8 characters or less. A missing numeric value is displayed as a period. A missing character value is displayed as a blank. False q. Character and Numeric p. Descriptor and Data o. False t. If the current date is February 1. The answer depends on the current date.
S f o o view a list of all the libraries available to your e SAS session A S No tsit d navigate to see all members of a specific library display the descriptor portion of a SAS data set ou 5. What window enables you to interactively browse a SAS data set? This new SAS data set must contain the following: Define the business scenario that will be used when reading from a SAS data set.
Data Sets. Worksheets r. Reading SAS data.. A S No tsita.. Reading Delimited a t data e infile input. Additional statements are added to the DATA step to complete all of the requirements. Raw Data Files y M. Reading SAS data. Reading Delimited data a t e infile input WHERE where-expression. Part 2 KEEP variable-list.
The SET statement can read temporary or permanent data sets. II AU pd01 Windows t r i S libname orion 's: M NOTE: Submit the program and confirm that a new SAS data set was created with 77 observations and 12 variables.
Operators are symbols that request a comparison. A S No tsit d e The where-expression is a sequence of operands and operators that form a set of instructions that define a condition for selecting observations. A variable operand must be a variable coming from an input data set. Numeric values do not use quotation marks. Character values must be enclosed in quotation marks and are case sensitive.
M a 34 r y i o n t a u t r i e Logical Operators r i b S p t Logical operators combine or modify expressions. Answer where Months in '5'. Answer d e where Months in 5. A S No tsit d e where salary not between and Equivalent Expressions: The operator can be used for both character and numeric variables.
S f o o The operator is case sensitive when you make e comparisons. A S No tsit Example: Consecutive underscores can be specified.
Office Rep b. The operator is case sensitive. P r f r There are two special characters available for specifying S o a pattern: For the LIKE operator. When you include an escape character.
If it is a single character. The operands must be character or string literals. The escape character expression is an expression that evaluates to a single character. Without an escape character. The special character underscore in the search pattern matches any single character.
A S No tsit the pattern-matching expression must be enclosed in quotation marks and it cannot contain a column d name. P f data work. Answer ia l c. S f o rset orion. P r data work. I 12 Fancine Kaiser Sales Rep.
I e 5 Fong Hofmeister Sales Rep. Submit the program and confirm that Work. Write a DATA step to read the data set orion. Spain ES. Labels and formats can also be stored in the descriptor portion. I pd04 I 5 Fong Hofmeister Sales Rep. A format is an instruction that SAS uses to write ia l data values.
January 1. S p o dis SA t A locale reflects the language. Local conventions might include specific formatting rules for dates. P r depending on the conventions that are accepted in a culture.
Dates have many representations. For more information. July 7. Adding Permanent Attributes to Work. TrimSport B. S P o o uppercase values. What are examples of logical operators? How can you limit the variables written to an output a t data set in the DATA step? Retrieve and submit the program.
Add a DATA step. What is the variable name that contains gender values? S f o o set orion. Keep only five variables. Write a DATA step. Retrieve the starter program.. These variables already have permanent labels assigned in the data set descriptor portion.
S No tsi run. True ia l False t e r a data work. Answer where Months in 5. Answer first name last name Nine Example: What statement is used to write to a SAS data set in e M a 3. DATA statement t r 2. How can you limit the variables written to an output ou data set in the DATA step? Chapter 6 Reading Excel Worksheets Reading Delimited infile. Data Sets P f. S f o e o libname.
Raw Data Files.. KEEP variable-list. The following Technical Support Usage Note addresses column data that is imported as missing: A S No tsit d e After submitting. Lotus Microsoft Access.
M a filename. Observation Length 0 Last Modified. Last Name 5 Salary Num 8 Salary Observations Variables Indexes Observation Length. A SAS name literal is a name token that is expressed as a string within quotation marks.
SAS name literals enable special characters to be included in data set names. P f libname orionxls 's: S r data work. M n run. IV Wednesday. II Saturday. October 1. July 1. III Tuesday. II Tuesday. I Thursday. November 1. August 1. I Tuesday.
I Monday. I Wednesday. II Sunday. IV Thursday. March 1. III Sunday. May 1. M a SAS disconnects from the data source and closes any 24 r y i n resources that are associated with that libref's connection. To disassociate a libref.
Double-click on the Orionxls library to show all Excel worksheets of that library. P r f DBMS. Reading an Excel Worksheet a. Submit the program to determine the names of the four worksheets in products. Reading a Range of an Excel Worksheet a. The worksheets in this Excel workbook do not have column names. Any member not containing a dollar sign in the name is an Excel range.
Add appropriate labels and formats based on the desired report. Customer Birth. A S No tsit d e libname orionxls 's: A t f e Base SAS and enable access to delimited files. To invoke the wizards from the SAS windowing environment,.
Select the table range or worksheet from which to import data. Select a location to store the imported file. Locate the input file. The Import Wizard 3. First Name. Job Title. Last Name 5 Salary Num 8 Salary. A t f e a valid database identifier. Note that if a column name contains special characters that are not valid in a SAS name, such as a blank, SAS converts the character to an underscore. The default is NO, which means that numeric data will be imported as missing values in a character column.
Select the data set from which you want to export data. Select the type of data source to which you want to export files. Assign the output file. Assign the table name. Select the type of data source to which you want o dis SA to export files. P f NOTE: File "S: To export a DBMS table. P r or delimited external file. P f 1 Select the worksheet containing children data. S f o r o 2 Name the new data set Work.
Use the Import Wizard to read the products. Open children. Level 3 ou 6. How do you disassociate a libref? What statement is used to point to a physical filename including the path. What is an example of a SAS name literal? M a run. A S No tsit data work. Use the Import Wizard. Examine the compilation and execution phases of the DATA step when reading a raw data file.
A data. Reading Delimited infile.. S f o e o libname.. S No tsi Worksheets. Raw Data Files. Sales Manager. The physical name is the name that the operating ou environment uses to access the file. INPUT specifications. Formatted input combines the flexibility of using informats with many of the features of column input. List input uses a scanning method for locating data values. Data values are not required to be aligned in columns.
Windows infile 's: By using formatted input. When you specify DSD. The DSD option specifies that o when data values are enclosed in quotation marks.