作者将常见的sas 处理分为不同的task,分别用两种不同的方法program,并比较,给出最佳及最有效的解决方法。
此书适合初学者或中级sas programmer.
全书共409页,共10个segment,每个segment平均有十个task.
For Example:
Task 3.7
Multiple Input Data Sets: Identifying the Source Data Set
Scenario:
You need to combine a group of data sets whose names are similar.
The combined data set must contain a variable that indicates which input data set contributed that
observation.
The old way:
Conditional Logic using IN= Variables
The identification of the input data set is performed by checking the IN= variables
defined for each input data set in the SET statement.
data combined;
set sashelp.prdsale(in=in_prdsale)
sashelp.prdsal2(in=in_prdsal2)
sashelp.prdsal3(in=in_prdsal3);
length Source $ 32;
if in_prdsale then source="PRDSALE";
else if in_prdsal2 then source="PRDSAL2";
else if in_prdsal3 then source="PRDSAL3";
run;
proc freq data=combined;
tables Source;
title1 "Source Data Sets for Combined Data";
run;
The new way: INDSNAME= Option in the SET Statement
(available in SAS 9.2)
An alternate approach is to use the INDSNAME= option in the SET statement, available starting in SAS
9.2.
The variable defined by the INDSNAME= option contains the complete input data set including the
libref, for a maximum length of 41 characters.
This technique is particularly valuable when combined with the data set list syntax introduced in SAS
9.2.
data combined;
set sashelp.prdsal: indsname=DataSetName;
length Source $ 32;
Source=scan(DataSetName,2);
run;
proc freq data=combined;
tables Source;
title1 "Source Data Sets for Combined Data";
run;



雷达卡



京公网安备 11010802022788号







