slide1 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Module I: Elementary Data Step Techniques PowerPoint Presentation
Download Presentation
Module I: Elementary Data Step Techniques

Loading in 2 Seconds...

play fullscreen
1 / 23

Module I: Elementary Data Step Techniques - PowerPoint PPT Presentation


  • 87 Views
  • Uploaded on

Module I: Elementary Data Step Techniques. Madan Gopal Kundu. SAS Resources. SAS Procedures guide: http://www.caspur.it/risorse/softappl/doc/sas_docs/proc/index.htm The Little SAS Book by Lora D Delwiche and Susan J Slaughter http://www.ats.ucla.edu/stat/sas/notes2/.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Module I: Elementary Data Step Techniques' - chapa


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide1

Module I:

Elementary Data Step Techniques

Madan Gopal Kundu

slide2

SAS Resources

  • SAS Procedures guide: http://www.caspur.it/risorse/softappl/doc/sas_docs/proc/index.htm
  • The Little SAS Book by Lora D Delwiche and Susan J Slaughter
  • http://www.ats.ucla.edu/stat/sas/notes2/
introduction
Introduction
  • Statistical Analysis System
  • Developed by Jim Goodnight in1970 at N.C. University for Agricultural Research
  • SAS Institute founded in 1976
  • 98 of world’s top 100 company in Fortune 500 use SAS
  • SAS Macro facility
sas windows
SAS Windows

To write/ modify SAS program code

  • Editor
  • Log
  • Output
  • Result
  • Explorer
  • Graph
  • To check execution of the program.
  • Helps in identify the error in SAS code
  • Tells about details such as amount of time it taken to execute the code

It displays the output generated upon execution of SAS code

It displays index of the output

It displays the list of libraries (containing SAS dataset), formats, compiled macros and graphs

It displays graph

slide5

EXPLORER

OUTPUT

RESULT

LOG

EDITOR

layout of sas programs
Layout of SAS Programs
  • SAS statement can be in upper- or lower case
  • All statements end with semicolon (;)
  • Statement can continue on the next line
  • Statements can be on the same line as other statements
  • Statements can start on any column
crating sas library

Statement to generate library

Name of the library

Path of the library

Crating SAS Library
  • Programmatically – Using LIBNAME statement
  • LIBNAME newlib ‘C:\’;
  • Non-programmatically
variable name
Variable name
  • Maximum 32 characters
  • Must start with a letter or an underscore
  • Contain only letters, numerals or underscores
  • Can contain upper- and lower case letters
  • Character variables always followed by $
creating datasets in sas
Creating Datasets in SAS
  • Using Data step

DATA newlib.one;

INPUT name $ roll score;

CARDS;

Ramen 122 95

Chris 123 84

Neha 124 90

Abdul 125 91

;

RUN;

??

newlib.one : The dataset ONE is in the library NEWLIB

importing data in sas
Importing Data in SAS
  • Import Wizard
  • Proc import
  • Data step
managing sas dataset
Managing SAS dataset
  • SET statement
  • KEEP statement
  • DROP statement
  • RENAME statement
  • WHERE statement
  • DELETE statement
  • LABEL statement
keep statement
KEEP statement

DATA new;

SET sashelp.class;

KEEP name sex age;

RUN;

It will keep only the selected variables. Remaining variables will be dropped.

drop statement
DROP statement

DATA new;

SET sashelp.class;

DROP name sex age;

RUN;

It will drop all the selected variables. Remaining variables will be as such.

renmae statement
RENMAE statement

DATA new;

SET sashelp.class;

RENAME Sex=Gender;

RUN;

Used to change the variable name.

label statement
LABEL statement

DATA new;

SET sashelp.class;

LABEL Age=‘Age (Yrs)’

Weight=‘Weight (Kg)’;

RUN;

Used to label the variable names.

where statement
WHERE statement

DATA new;

SET sashelp.class;

WHERE sex=‘F’;

RUN;

Used to add some condition to the dataset.

where statement1
WHERE statement

DATA new;

SET sashelp.class;

WHERE Age>13;

RUN;

Used to add some condition to the dataset.

merging datasets
Merging datasets
  • Sort the dataset using PROC SORT
  • Merge the datasets in datastep
merging datasets1
Merging datasets

ONE

TWO

+

FINAL

sas system options
SAS System options
  • CENTER| NOCENTER
  • DATE|NODATE
  • LINESIZE=n (64-256)
  • PAGESIZE=n (15-32767)
  • PAGENO=n
  • RIGHTMARGIN=n
  • LEFTMARGIN=n
  • TOPMARGIN=n
  • BOTTOMMARGIN=n
slide23
Task…
  • Create a library in SAS
  • Create the following SAS dataset
  • Get a copy of that dataset using SET statement
  • Label the variable WT as ‘Weight (kg)’