- proc import out=turnover
- datafile="d:\stock.xls"
- dbms=xls
- replace;
- getnames=yes;
- run;
- proc sql;
- create table average1 as
- select share , date,avg(turnover) as turnover_avg1
- from turnover
- group by share , date;
- quit;
- proc sql;
- create table average2 as
- select date, avg(turnover_avg1) as avg2
- from average1
- group by date;
- quit;
复制代码log:19 proc import out=turnover
20 datafile="d:\stock.xls"
21 dbms=xls
22 replace;
23 getnames=yes;
24 run;
NOTE: The import data set has 16 observations and 3 variables.
NOTE: WORK.TURNOVER data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
25 proc sql;
26 create table average1 as
27 select share , date,avg(turnover) as turnover_avg1
28 from turnover
29 group by share , date;
NOTE: Table WORK.AVERAGE1 created, with 4 rows and 3 columns.
30 quit;
NOTE: PROCEDURE SQL used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
31
32
33
34 proc sql;
35 create table average2 as
36 select date, avg(turnover_avg1) as avg2
37 from average1
38 group by date;
NOTE: Table WORK.AVERAGE2 created, with 2 rows and 2 columns.
39 quit;
NOTE: PROCEDURE SQL used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds