Академический Документы
Профессиональный Документы
Культура Документы
What is SAS
Overview
SAS Language
SAS Procedures
Macro Facility
Data Step Debugger
Output Delivery System (ODS)
Components of a SAS Program
‘ Raw Data
SAS Data
Set
Components of a SAS Program
Data Step
This step creates a SAS data set by processing input data. The input data
can be in the form of raw data, another SAS data set or assignment
statements.
Proc Step
This step will execute a SAS procedure, with a SAS data set as input. It will
help us to analyze the data in a data set, produce reports and other results.
Data, Observation, and Variables
Data - Concept
Variable / Column
Values
Observation / Rows
DATA / TABLE
Only 2 types of variables - Numeric and Character
SAS Variables
store
- 365 0 366
display
Initialize variables
to missing
YES
Execute input statement End of file
• The execution starts with the data statement. Every time this statement executes,
the automatic variable _n_ is incremented by 1.
• The variables in PDV are set to missing.
• The record from the flat file is read into the input buffer.
• Other statements in the step get executed for the current record.
• At the end of the step, the observation is written to the output data set, the
pointer returns to the top of the data step and the variables in the PDV are reset
to missing.
• The data step terminates when SAS encounters the end of the flat file
Advanced Data Processing Data
SAS
1----------12----------24--------32—36----------46
parthiban sudhan 10/29/014000mastercard
sood shalabh 10/19/012000visa
vatsal bhakta 12/11/005000visa
kumar praveen 12/21/003000mastercard
Data Step
data acct_arr;
infile ‘flat file name’;
input @1 lastname $12. @13 firstname $12. @25 open_date mmddyy8.
@33 credit_lmt 4. @37 card_type $10.;
run;
SAS Data Set
DATA1 DATA2
DATA1
DATA1 DATA1
DATA2
DATA2
DATA2
Merging KEY
Variable
IF aa and bb
PROC
MEANS
Thousands of PROCedures...
Structured Query Language
SQL
PROC SQL ;
SELECT SUM(Amt) AS Spend
FROM MyTable
WHERE Month = ‘Dec’ ;
QUIT ;