Unit_3_ - Introduction to SAS Programming STSCI501 Fall...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Introduction to SAS Programming STSCI501 – Fall 2007 Simona Despa Cornell Statistical Consulting Unit (CSCU)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Part 3 Working with SAS data Overview Coding and Recoding variables SAS Functions IF-Then, IF-Then/Else, Where , KEEP, DROP, RETAIN, SUM SAS Dates SAS Functions Arrays
Background image of page 2
3 Creating and Recoding Variables: SAS Data Set SASUser.Laguardia
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 View Data Set Properties with Proc Contents proc contents data=sasuser.laguardia; run; Alphabetic List of Variables and Attributes # Variable Type Len Format 6 Boarded Num 8 2 Date Num 8 DATE7. 3 Depart Num 8 TIME5. 8 Deplaned Num 8 5 Dest Char 3 1 Flight Char 3 4 Orig Char 3 9 Revenue Num 8 7 Transferred Num 8
Background image of page 4
5 Variable Attributes Name SAS variable names can be up to 32 characters in length The first character must begin with an English letter or an underscore. Subsequent characters can be English letters, numeric digits, or underscores. A variable name cannot contain blanks. Type : identifies a variable as Numeric Character
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Variable Attributes Length : refers to the number of bytes used to store each of the variable's values in a SAS data set. - All numeric variables have a length of 8 (during processing ) - Default 8; in the INPUT statement, you can assign a length other than the default length to character variables
Background image of page 6
7 Variable Attributes Format : refers to the instructions that SAS uses when printing variable values. - SAS formats can be assigned to a variable in the FORMAT statement - You can use the Proc FORMAT to create your own format for a variable
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Creating and Redefining Variables To create a new variable from existing ones: PerPassenger = Revenue/Deplaned Data Laguardia; Set sasuser.Laguardia; PerPassenger= Revenue/Deplaned; Run;
Background image of page 8
9 Creating and Redefining Variables Modify an existing variable: Data Laguardia; Set sasuser.Laguardia; Revenue=Revenue/1000; Run; Notice that SAS replaces existing variable with the new one
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/13/2008 for the course STSCI 5010 taught by Professor Bunge during the Fall '07 term at Cornell University (Engineering School).

Page1 / 32

Unit_3_ - Introduction to SAS Programming STSCI501 Fall...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online