BookmarkSubscribeRSS Feed
Marcio1
Calcite | Level 5

 

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

6 REPLIES 6
PaigeMiller
Diamond | Level 26

@Marcio1 wrote:

 

Mas esta acontecendo esse erro:

 

 

SYMBOLGEN: Macro variable TS_INICIO resolves to 1892331014.57543

 


SYMBOLGEN does not indicate a SAS error.

--
Paige Miller
Marcio1
Calcite | Level 5

Não é bem um erro mas  a consulta:

 

%let ts_inicio = %sysfunc(datetime());

 

esta retornando o numero: 1892331014.57543

PaigeMiller
Diamond | Level 26

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

 

 

--
Paige Miller
Marcio1
Calcite | Level 5

O objetivo da macro é aguardar o termino de uma rotina testando seu fim a cada 60 segundos durante uma hora.

PaigeMiller
Diamond | Level 26

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

--
Paige Miller
PaigeMiller
Diamond | Level 26

Or to use macro variables

 

%let one_minute_later=%sysevalf(&ts_inicio+60);

%let one_hour_later=%sysevalf(&ts_inicio+3600);

--
Paige Miller

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1473 views
  • 0 likes
  • 2 in conversation