SAS-Manipulate_Datasets

SAS-Manipulate_Datasets - Manipulating SAS Manipulating SAS...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: Manipulating SAS Manipulating SAS Datasets Datasets Last Updated : 29 June, 2004 Center of Excellence Data Warehousing Objectives Control which variables are written to an output data set during a DATA step. Control which variables are read from an input data set during a DATA step. Control how many observations are processed from an input data set during a DATA or PROC step. Controlling Variable Output By default, the SAS System writes all variables from every input data set to every output data set. In the DATA step, the DROP and KEEP statements can be used to control which variables are written to output data sets. The DROP and KEEP Statements (Review) Input SAS data set PDV DROP and KEEP statements Raw data file Output SAS data set ... Creating Multiple SAS Data Sets (Review) Partial PROC CONTENTS Output proc contents data=prog2.military; run;- - - - - 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 6 Ai r por t Char 40 37 3 Ci t y Char 20 12 2 Code Char 3 9 5 Count r y Char 3 34 4 St at e Char 2 32 1 Type Char 9 Creating Multiple SAS Data Sets (Review) data army navy airforce marines; drop Type; set prog2.military; if Type eq 'Army' then output army; else if Type eq 'Naval' then output navy; else if Type eq 'Air Force' then output airforce; else if Type eq 'Marine' then output marines; run; Creating Multiple SAS Data Sets (Review) Partial Log NOTE: Ther e wer e 137 obser vat i ons r ead f r om t he dat a set PROG2. MI LI TARY. NOTE: The dat a set WORK. ARMY has 41 obser vat i ons and 5 var i abl es. NOTE: The dat a set WORK. NAVY has 28 obser vat i ons and 5 var i abl es. NOTE: The dat a set WORK. AI RFORCE has 64 obser vat i ons and 5 var i abl es. NOTE: The dat a set WORK. MARI NES has 4 obser vat i ons and 5 var i abl es. Controlling Variable Output The DROP and KEEP statements apply to all output data sets....
View Full Document

Page1 / 32

SAS-Manipulate_Datasets - Manipulating SAS Manipulating SAS...

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

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