->In a SAS data set, each row represents information about an individual entity and is
called an observation.
->Each column represents the same type of information and is
called a variable.
->Each separate piece of information is a data value. In a SAS data set,
an observation contains all the data values for an entity;
->A variable contains the same type of data value for all entities.
To build a SAS data set with Base SAS, you write a program that uses statements in
the SAS programming language. A SAS program that begins with a DATA statement
and typically creates a SAS data set or a report is called a DATA step.
The following SAS program creates a SAS data set named WEIGHT_CLUB.
CODE Window:-
Log window:-
Result Window;-
-> The DATA statement tells SAS to begin building a SAS data set named
WEIGHT_CLUB.
-> The INPUT statement identifies the fields to be read from the input data and
names the SAS variables to be created from them (Id, Name, Team,
Start_Weight, and End_Weight).
-> The third statement is an assignment statement. It calculates the weight each
person lost and assigns the result to a new variable, Lost_weight.
-> The DATALINES statement indicates that data lines follow.
The data lines follow the DATALINES statement. This approach to processing
raw data is useful when you have only a few lines of data.
-> The semicolon signals the end of the raw data, and is a step boundary. It tells
SAS that the preceding statements are ready for execution.
This procedure, known as the PRINT procedure, displays the variables in a simple,
organized form. The following output shows the results:
Rules for SAS Statements
-> SAS statements end with a semicolon.
-> You can enter SAS statements in lowercase, uppercase, or a mixture of the two.
-> You can begin SAS statements in any column of a line and write several
statements on the same line.
-> You can begin a statement on one line and continue it on another line, but you
cannot split a word between two lines.
-> Words in SAS statements are separated by blanks or by special characters
Rules for Most SAS Names
SAS names are used for SAS data set names, variable names, and other items. The
following rules apply:
->A SAS name can contain from one to 32 characters.
-> The first character must be a letter or an underscore (_).
->Subsequent characters must be letters, numbers, or underscores.
-> Blanks cannot appear in SAS names.
called an observation.
->Each column represents the same type of information and is
called a variable.
->Each separate piece of information is a data value. In a SAS data set,
an observation contains all the data values for an entity;
->A variable contains the same type of data value for all entities.
To build a SAS data set with Base SAS, you write a program that uses statements in
the SAS programming language. A SAS program that begins with a DATA statement
and typically creates a SAS data set or a report is called a DATA step.
The following SAS program creates a SAS data set named WEIGHT_CLUB.
data weight_club;
input id 1-4 name $ 6-13 team $ start_weight end_weight ;
lost_weight= start_weight-end_weight;
datalines;
1234 xvbzn red 25 24
2345 zccvb yellow 23 34
3234 zccc blue 33 44
;
run;
proc print;
title ’Test Data’;
CODE Window:-
Log window:-
Result Window;-
-> The DATA statement tells SAS to begin building a SAS data set named
WEIGHT_CLUB.
-> The INPUT statement identifies the fields to be read from the input data and
names the SAS variables to be created from them (Id, Name, Team,
Start_Weight, and End_Weight).
-> The third statement is an assignment statement. It calculates the weight each
person lost and assigns the result to a new variable, Lost_weight.
-> The DATALINES statement indicates that data lines follow.
The data lines follow the DATALINES statement. This approach to processing
raw data is useful when you have only a few lines of data.
-> The semicolon signals the end of the raw data, and is a step boundary. It tells
SAS that the preceding statements are ready for execution.
This procedure, known as the PRINT procedure, displays the variables in a simple,
organized form. The following output shows the results:
Rules for SAS Statements
-> SAS statements end with a semicolon.
-> You can enter SAS statements in lowercase, uppercase, or a mixture of the two.
-> You can begin SAS statements in any column of a line and write several
statements on the same line.
-> You can begin a statement on one line and continue it on another line, but you
cannot split a word between two lines.
-> Words in SAS statements are separated by blanks or by special characters
Rules for Most SAS Names
SAS names are used for SAS data set names, variable names, and other items. The
following rules apply:
->A SAS name can contain from one to 32 characters.
-> The first character must be a letter or an underscore (_).
->Subsequent characters must be letters, numbers, or underscores.
-> Blanks cannot appear in SAS names.
0 comments:
Post a Comment