Date: Mon, 20 Sep 2004 17:17:10 -0400
Reply-To: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject: Re: how to compare current time with......?
Actually a very good question.
Now here's an alternative: Do you want code which will check the clock,
then "sleep" until 11 am if necessary, then run the report? That may
actually be simpler to do.
On Sat, 18 Sep 2004 08:38:54 -0400, Richard A. DeVenezia
<radevenz@IX.NETCOM.COM> wrote:
>Anna wrote:
>> Hi,
>> sorry for that stupid question, but I am just starting learing SAS. I
>> managed to write my first report in SAS, but the thing is, that the
>> report can't be executed before 11 am . So what I have to do is to
>> check current time and if is before 11 am call for example %macro1
>> which will just print short info , in the other case call %macro2
>> with the report. Can anybody help me? I am getting crazy about all
>> these formatting in SAS , and I don't know how to get an hour from
>> time() and convert in into the number.
>
>Hold on! Questions are not stupid, they are the vehicle to anti-stupidity.
>There are many date and time functions and formats. Since you are dealing
>with date and time as data for evaluation, thus at this juncture you should
>be more interested in the functions(). Search the online help index for
>"HOUR Function".
>
>Suppose you have one main macro that dispatches macro1 or macro2 depending
>on the time of day.
>
>---
>main.sas
>---
>%macro main()
>
> %local now hour;
> %let now = %sysfunc (time());
> %let hour = %sysfunc (hour(&now));
>
> %if &hour < 11 %then %do;
> %macro1
> %end;
> %else %do;
> %macro2
> %end;
>
>%mend;
>
>%main
>
>
>> sas.exe main.sas
>
>
>Ask me to do your homework, now that would be stupid.
>
>--
>Richard A. DeVenezia
>http://www.devenezia.com/
|