Boa tarde, alguém poderia ajudar?
Estou tentando rodar essa macro:
%macro aguardarProcessamento(rotina=rotina.sas, maxTempoEspera=3600, intervalo=60);
*options nosource;
%let ts_inicio = %sysfunc(datetime());
%let duracao = 0;
%let qtdeRotinasAtivas = 0;
%do %while ((%sysevalf(%sysfunc(datetime()) - &ts_inicio) < &maxTempoEspera) and &ts_inicio ne 0);
%ps;
%let aindaRodando = 0;
proc sql noprint;
select count(pid) as id into :aindaRodando
from work.out_ps
where cmd contains "&rotina..sas";
quit;
%if (&aindaRodando > 0) %then %do;
data _null_;
call sleep(&intervalo,1);
;run;
%end;
%else %do;
%let ts_inicio = 0;
%end;
%end;
*options source;
%mend;
%aguardarProcessamento;
Mas esta acontecendo esse erro:
SYMBOLGEN: Macro variable TS_INICIO resolves to 1892331014.57543
@Marcio1 wrote:
Mas esta acontecendo esse erro:
SYMBOLGEN: Macro variable TS_INICIO resolves to 1892331014.57543
SYMBOLGEN does not indicate a SAS error.
Não é bem um erro mas a consulta:
%let ts_inicio = %sysfunc(datetime());
esta retornando o numero: 1892331014.57543
DATETIME() returns a number, indicating the number of seconds since midnight on january 1, 1960, so this number is correct.
Perhaps you want a formatted value, like this
%let ts_inicio = %sysfunc(putn(%sysfunc(datetime()),datetime16.));
However, I caution you, as I caution everyone, that working with the number in SAS rather than the formatted value is much easier to do. The only time you really need to format a macro variable is to use it in a title or label. Anything else you will do is easier done if the macro variable contains the SAS date/time number of 1892331014.57543
O objetivo da macro é aguardar o termino de uma rotina testando seu fim a cada 60 segundos durante uma hora.
So if the number you get is 1892331014.57543, then to find the time 60 seconds later, you would use
1892331014.57543+60
To find one hour later, you would use 1892331014.57543+3600
Or to use macro variables
%let one_minute_later=%sysevalf(&ts_inicio+60);
%let one_hour_later=%sysevalf(&ts_inicio+3600);
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.