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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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