lecture_04 - Lecture #4 I assume now that you will be able...

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

View Full Document Right Arrow Icon
Lecture #4 I assume now that you will be able to read any kind of data into SAS, so now we will begin: Working within the DATA step: Subsetting datasets By observation By variable Creating new variables Performing mathematical operations and using SAS numeric functions.
Background image of page 1

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

View Full DocumentRight Arrow Icon
When you use a SAS data set as input into a DATA step, the description of the data set is available to SAS (SAS does not have to produce this on it’s own leading to a more efficient use of resources) The DATA step can be used in this manner to either: READING A SAS DATA SET Create a new data set that contains only a subset of the observations in the original data set Create a new data set that contains only a subset of the variables in the original data set.
Background image of page 2
Consider the following partial output from running PROC CONTENTS on a SAS data set named CITY, which contains information about expenditures for a small city for the years 1980 through 2000. READING A SAS DATA SET - - - - - Al phabet i c Li st of Var i abl es and At t r i but es- - - - - # Var i abl e Type Len Pos Label ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ 5 Adm i nLabor Num 8 32 Adm i ni st r at i on: Labor 6 Adm i nSuppl i es Num 8 40 Adm i ni st r at i on: Suppl i es 9 Adm i nTot al Num 8 64 Adm i ni st r at i on: Tot al 7 Adm i nUt i l i t i es Num 8 48 Adm i ni st r at i on: Ut i l i t i es 3 Ser vi cesFi r e Num 8 16 Ser vi ces: Fi r e 2 Ser vi cesPol i ce Num 8 8 Ser vi ces: Pol i ce 8 Ser vi cesTot al Num 8 56 Ser vi ces: Tot al 4 Ser vi cesWat er _Sewer Num 8 24 10 Tot al Num 8 72 Tot al Out l ays 1 Year Num 8 0
Background image of page 3

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

View Full DocumentRight Arrow Icon
FI RSTOBS : Data set option indicating which observation should be the first one processed OBS : Data set option indicating which observation should be the last one processed To create a SAS data set that contains observations for 1989 (10 th obs.) through 1994 (15 th obs.): READING SELECTED OBS. DATA CI TY2; SET CI TY ( FI RSTOBS=10 OBS=15) ; RUN;
Background image of page 4
KEEP= : Data set option indicating for SAS to read only a specified subset of variables in the original data set To create a SAS data set that contains only the variables that represent the services-related expenditures: READING SELECTED VARS. DATA SERVI CES; SET CI TY ( KEEP=YEAR SERVI CESTOTAL SERVI CESPOLI CE SERVI CESFI RE SERVI CESWATER_SEWER) ; RUN;
Background image of page 5

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

View Full DocumentRight Arrow Icon
: Data set option indicating for SAS to exclude a specified subset of variables in the original data set An alternate way to create a SAS data set that contains only the variables that represent the services-related expenditures: READING SELECTED VARS. DATA
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 28

lecture_04 - Lecture #4 I assume now that you will be able...

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

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