由买买提看人间百态

topics

全部话题 - 话题: timeflag
(共0页)
d****i
发帖数: 121
1
来自主题: Statistics版 - SAS Macro求教
我有个dataset,大致如下:
name time trade
AAA 9:00:00 xx
AAA 13:00:00 xx
AAA 15:20:30 xx
BBB 8:20:30 xx
BBB 12:30:00 xx
... ... ...
要求用macro计算各个公司上下午的trade frequency,以及上下午的trade frequency
different。
我把公司的名字已经从上面提取出来放在firms这个file里面了,上面的dataset我也标
记了timeflag,上午0,下午1;
下面是我的程序:
data allfirm;
set test3;
if time<"12:00:00" then timeflag=0;
if time>="12:00:00" then timeflag=1;
run;
%let firms=&firm
y****g
发帖数: 285
2
来自主题: Statistics版 - SAS Macro求教
I do not think you need a macro for this,
why not just use
proc freq
tables
or
proc summary ... ;
...
class firmname timeflag;
output out= ...;
To get results automatically from SAS, you can seperate the output table by
timeflag, then join the two tables by firmname and calculate the difference.
Then export the final table as a csv file or txt file
or you can do these steps in Excel
(共0页)