楼主: riosen
3259 4

[求助]程序运行时间 [推广有奖]

  • 2关注
  • 1粉丝

讲师

84%

还不是VIP/贵宾

-

威望
0
论坛币
778 个
通用积分
0
学术水平
0 点
热心指数
2 点
信用等级
0 点
经验
2498 点
帖子
162
精华
0
在线时间
1015 小时
注册时间
2007-1-16
最后登录
2014-5-5

楼主
riosen 发表于 2009-4-16 23:34:00 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

我在自己的PC上运行SAS宏程序,估计时间较长,起码要好几小时,请问能否在运行时,查看运行需要多少时间或倒计时?

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:运行时间 SAS宏程序 SAS宏 倒计时 宏程序 运行 求助 时间 程序

回帖推荐

nkwilling 发表于3楼  查看完整内容

/***************************************************************************************//* 指定LOG存放目录,程序统计该目录下所有LOG程序的运行时间 */%let pathname=%str(D:\Downloads); /********** 程序开始 **********/options noxwait;x "cd &pathname.";x "dir *.log >dirfile"; filename dirfile "&pathname.\dirfile";data lognamefile; infile dirfile end=fend length=length; length logname ...

本帖被以下文库推荐

沙发
爱萌 发表于 2009-4-17 09:38:00
应该是可以的,但我历来都是通过log看时间的
最恨对我说谎或欺骗我的人

藤椅
nkwilling 发表于 2009-4-17 18:27:00

/***************************************************************************************/
/* 指定LOG存放目录,程序统计该目录下所有LOG程序的运行时间 */
%let pathname=%str(D:\Downloads);

/********** 程序开始 **********/
options noxwait;
x "cd &pathname.";
x "dir *.log >dirfile";

filename dirfile "&pathname.\dirfile";
data lognamefile;
 infile dirfile end=fend length=length;
 length logname str $255;
 input str $varying. length;
 if length>40 and lowcase(substr(str,length-3,4))='.log' then do;
  logname=substr(str,37,length-36);
  keep logname;
  output;
 end;
run;

x "del dirfile";

%macro real_time();
 %if %sysfunc(exist(pgm_real_time)) %then %do;
  proc delete data=pgm_real_time;run;
 %end;
 %let dsid=%sysfunc(open(lognamefile));
 %if &dsid>0 %then %do;
   %let nobs=%sysfunc(attrn(&dsid,nobs));
  %do i=1 %to &nobs;
   %let rc=%sysfunc(fetchobs(&dsid,&i));
   %let logname=%sysfunc(getvarc(&dsid,%sysfunc(varnum(&dsid,logname))));
   %put 开始计算LOG程序运行时间:&logname;
   filename logfile "&pathname.\&logname.";
   data pgm_real_time_0;
    infile logfile end=fend length=length;
    length real_time cpu_time $20 log_name $100 data_step $10 str $255;
    log_name="&logname.";
    retain data_step real_time end_flag;
    input str $varying. length;
    if find(str,'NOTE: SAS 系统所用时间:','I') then do;
     end_flag=1;
    end;
    if find(str,'实际时间','I') then do;
     if end_flag ne 1 then do;
      n+1;
      data_step=compress("第"||put(n,z6.)||"步");
      real_time=left(compress(str,'实际时间'));
     end;
     else do;
      data_step="合计";
      real_time=left(compress(str,'实际时间'));
     end;
    end;
    if find(str,'CPU 时间','I') then do;
     cpu_time=left(compress(str,'CPU 时间'));
     output;
    end;
    drop n str end_flag;
   run;
   proc append base=pgm_real_time data=pgm_real_time_0;run;
   proc delete data=pgm_real_time_0;run;
  %end;
 %end;
 %let dsid=%sysfunc(close(&dsid));
%mend;

%real_time;

/********** 程序结束 **********/

在SAS应用班视频教学里面有很详细的程序解读。


已有 1 人评分经验 论坛币 收起 理由
bakoll + 3 + 3 精彩帖子

总评分: 经验 + 3  论坛币 + 3   查看全部评分

板凳
onlystrong 发表于 2010-6-13 15:02:55
请问nkwilling,你是姚志勇么? 久仰久仰啊! 能否给个联系方式,向您请教一些建模的问题!

报纸
nkwilling 发表于 2010-6-13 15:15:52
onlystrong 发表于 2010-6-13 15:02
请问nkwilling,你是姚志勇么? 久仰久仰啊! 能否给个联系方式,向您请教一些建模的问题!
你给我QQ,发到我站内邮箱。另外,希望不要在公共场合直呼其名,低调点^_^。

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-30 11:27