DATASTEP OPTIONS ARE:
1. Drop
2. Keep
3. Rename
4. Firstobs
5. Obs
6. Index
7. Label
8. Pw ( password)
9. Where
/*1. Drop data step option*/
Excludes variables from processing or from output SAS data sets.Valid: DATA step and PROC steps.
In DATA steps, the DROP= data set option can apply to both input and output data sets.
The DROP statement applies only to output data sets.;
/*Ex*/
A00010 AC 5
A00010 TA 6
A00010 GC 3
;
Drop statement along with set statement: ;
eg:
Data temp;
Run;
/*Drop can be used in
eg:
Run;
/*2
Specifies variables for processing or
Valid: DATA step and PROC steps.;
In DATA steps, the KEEP= data set option can apply to both input and output data sets. The KEEP statement applies only to output data sets
*eg*
Input sid$ motif$
A00010 AC 5
A00010 TA 6
;
Run;
/*Keep= option with SET Statement
eg:
Data est2;
Set est1
Bonus=sid*1
Run;
/*keep can be used in
eg:
Run;
/*3
Changes the name of a variable.
The RENAME= data set option can be used in PROC steps and the RENAME statement cannot.
To rename variables before processing begins,
Valid: DATA step and PROC steps.
Syntax:
RENAME= (old-name-1=new-name-1);
Old-name is The variable you want to rename.
New-name The new name of the variable.
It must be a valid SAS name.;
/*Ex
Data est2 (rename= (sid=seq_id
Input Sid$ motif$
A00010 AC 5
A00010 TA 6
;
Run;
/*Rename= option with SET Statement
eg:
Data est3;
Set est2
Run;
/*Rename can be used in
eg:
Run;
/*4
Specifies which observation SAS processes first.
Valid: DATA step and PROC steps.
/*Syn
FIRSTOBS= MIN | MAX | n|.
/*note*/
The FIRSTOBS= data set option affects a single,
You can apply FIRSTOBS= processing to WHERE processing.;
/*firstobs= option with SET Statement
/*Ex*/
Data Temp;
Run;
/*We can apply First
eg:
Run;
/* firstobs= option with input data set not valid*/
Data est2; (firstobs=3);
Input Sid$ motif$
A00010 AC 5
A00010 TA 6
A00010 AC 7
A00010 TA 8
;
Run;
/*5
Specifies which observation SAS processes last.
Syntax
OBS= MIN | MAX | n;
This option specifies the number of the last observation to process, not how many observations should be processed.
/*It is valid only when an existing SAS data set is read
The OBS= data set option overrides the OBS= system option for the individual data set
You can select observations to be read from external
/*obs= option with SET Statement
/*Ex*/
Data new;
Set a (obs=10);
Run;
/*How to apply in Proc step both firstobs= obs=options
eg:
/*starting at 4th
Run;
/*6
Defines indexes when a SAS data set is created.;
Data
dsn=data set name
/*Ex*/
Data est1 (index=
A00010 AC 5
A00011 TA 6
;
/*7
Specifies a label for the SAS data set.
• The LABEL= data set option enables you to specify labels only for data sets. You can specify labels for the variables in a data set using the LABEL statement.
• The LABEL= option in the ATTRIB statement also enables you to assign labels to variables.
/*Syn*/
Data
dsn=data set name
/*Ex*/
Data
Input sid$ motif$
A00010 AC 5
A00010 TA 6
;
/*8
Assigns a read, write, or alter password to a SAS file and
Valid: DATA step and PROC steps.
The PW= option applies to all types of SAS files except catalogs.
You can use this option to assign a password to a SAS
/*Ex*/
Data
Input sid$ motif$
A00010 AC 5
A00010 AC 6
A00011 TC 7
;
/*9
Use the WHERE= data set option with an input
You can also select observations that are written to an output data set.
The WHERE statement applies to all input data sets,
/*Ex*/
Data est1 (WHERE=
Input sid$ motif$
A00010 AC 5
A00010 AC 6
A00011 TC 7
A00011 TC 8
;
/*Where= option with SET Statement
eg:
Data
Set est3
Run;
/*Where= can be used in
eg:
Run;