Q)What are different SAS VIEWS.
Q)What is the difference between SAS File and SAS View
Q)Describe PROC SQL and Data Step view
The main difference between
SAS data files and SAS data views is where the data
values are stored.
A SAS data file contains both
descriptor and the data values
A SAS data view
contains only the descriptor information about the data and
instructions on how to retrieve data values that are stored elsewhere.
DATA
Step View
A
partially compiled DATA step program that can read data from different sources.
A DATA step view can be created only in a DATA step.
Creating
a SAS DATA Step View
the DATA step is partially compiled and the intermediate code is stored in the
specified SAS data library with a member type of VIEW.
data company.newdata / view=company.newdata;
infile <fileref>;
<DATA step statements>
run;
Referencing
a SAS DATA Step View
the compiler resolves the intermediate code and generates executable code for thehost environment
the generated code is executed as the DATA or PROC step requests observations.
PROC SQL VIEW
CREATE VIEW proc-sql-view AS
SELECT column-1<, ... column-n>
FROM table-1 | view-1<, ... table-n | view-n>
<optional query clauses>;
You can use a DESCRIBE VIEW statement to display a definition of a view in the
SAS log.
proc sql;
describe view sasuser.faview;
data A B /
view = A; set sasuser.Cars; if origin =
'European' then output A; else if origin =
'Cuba' then output B; run; data _null_; set A; run; proc print
data = A; run; |
there
will be no error even if we don’t use yellow text … |
data A B /
view = A; set sasuser.Cars; if origin =
'European' then output A; else if origin =
'Cuba' then output B; run; data _null_; set A; run; proc print
data = B; run; |
there
will be error if we don’t use yellow text … We need
to refer VIEW sasuser.ranch once before referring
to sasuser.condo. |
No comments:
Post a Comment