Summary of Lesson 4 - Preparing Data
Summary of Lesson 4 - Preparing Data
DATA output-table;
SET input-table;
RUN;
DATA output-table;
SET input-table;
WHERE expression;
RUN;
DATA output-table;
SET input-table;
FORMAT col-name format;
RUN;
DATA output-table;
SET input-table;
new-column = expression;
RUN;
The name of the column to be created or updated is listed on the left side of the equals sign.
SAS automatically defines the required attributes if the column is new – name, type, and
length.
The length of a new character column is determined based on the length of the assigned
string.
DATA output-table;
SET input-table;
new-column=function(arguments);
RUN;
Character functions:
MDY(month, day, year) returns SAS date value from month, day, and year values
YRDIF(startdate, enddate, calculates a precise age between two dates. There are various
‘AGE’) values for the third argument. However, "AGE" should be used
for accuracy.
Conditional Processing
Copyright © 2022 SAS Institute Inc., Cary, NC, USA. All rights reserved.
: