由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - SAS Macro求教
相关主题
[SAS]怎么快捷地删除Macro 里创建的临时dataset和macro variabHelp: an I/O ERROR occured
[合集] 问个SAS的问题windows下用batch submit 两个SAS code文件
[合集] 用SAS生成表格,怎么弄比较好?SAS Programmer for clinical trials
请教SAS macro一个SAS Macro和Append的问题,救助!
SAS DATA 求助My $0.02 on SAS debugging in Linux environment.
How to set initial dataset to zero in a SAS macro?SAS CODE HELP!
two SAS macro questions关于SAS interview
%do questionsPlease help with a SAS macro
相关话题的讨论汇总
话题: 00话题: timeflag话题: firms话题: macro话题: aaa
进入Statistics版参与讨论
1 (共1页)
d****i
发帖数: 121
1
我有个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
a********a
发帖数: 346
2
%let firms=&firms?
You have not defined firms here. So &firms can not be resolved.
It should be written like
%let firms=mitbbs (whatever name you want to give)
y****g
发帖数: 285
3
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
1 (共1页)
进入Statistics版参与讨论
相关主题
Please help with a SAS macroSAS DATA 求助
How to Macro it in SAS?How to set initial dataset to zero in a SAS macro?
SAS clinical trainingtwo SAS macro questions
SAS clinical training%do questions
[SAS]怎么快捷地删除Macro 里创建的临时dataset和macro variabHelp: an I/O ERROR occured
[合集] 问个SAS的问题windows下用batch submit 两个SAS code文件
[合集] 用SAS生成表格,怎么弄比较好?SAS Programmer for clinical trials
请教SAS macro一个SAS Macro和Append的问题,救助!
相关话题的讨论汇总
话题: 00话题: timeflag话题: firms话题: macro话题: aaa