General form, DATA step
to create a DATA step view:
DATA SAS-data-view <SAS-data-file-1
... SAS data-file-n> /
VIEW=SAS-data-view;
<SAS
statements>
RUN;
SAS-data-view
names the data view
to be created.
SAS-data-file-1 ... SAS-data-file-n
is an optional list
that names any data files to be created.
SAS statements
includes other DATA
step statements to create the data view and any data files that are
listed in the DATA statement.
|
data view=company.newdata; describe; run;
data company.roster_view/view=company.roster_view; merge company.roster company.demog; by lastname; run;Now suppose Company.Roster changes so that LastName is named Surname. Your data view must also be updated.
data roster_view/view=roster_view; merge company.roster company.demog(rename=(LastName=Surname)); by lastname; run;
Data View
This program reads data
from a raw data file, creates a SAS DATA step view named Retail.Custview,
and then reads from the new DATA step view. The first DATA step creates
the data view Retail.Custview. The second DATA step reads from the
DATA step view.
data retail.custview / view = retail.custview; infile flat1; input @1 Customer_ID 12. @13 Country $2. @15 Gender $1. @16 Personal_ID $15. @31 Customer_Name $40. @71 Customer_FirstName $20. @91 Customer_LastName $30. @121 Birth_Date date9. @130 Customer_Address $45. @175 Street_ID 12. @199 Street_Number $8. @207 Customer_Type_ID 8.; run; data _null_; set retail.custview; run; |
Data File
This program reads data
from a raw data file, creates a SAS data file named Retail.Custdata,
and reads from the new SAS data file. The first DATA step creates
the data file Retail.Custdata. The second DATA step reads from the
data file.
data retail.custdata; infile flat1; input @1 Customer_ID 12. @13 Country $2. @15 Gender $1. @16 Personal_ID $15. @31 Customer_Name $40. @71 Customer_FirstName $20. @91 Customer_LastName $30. @121 Birth_Date date9. @130 Customer_Address $45. @175 Street_ID 12. @199 Street_Number $8. @207 Customer_Type_ID 8.; run; data _null_; set retail.custdata; run; |