| Date: | Thu, 25 Jun 2009 18:35:41 -0400 |
| Reply-To: | Arthur Tabachneck <art297@NETSCAPE.NET> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Arthur Tabachneck <art297@NETSCAPE.NET> |
| Subject: | Re: Do Loop Macro |
|
Paul,
A couple of problems:
First, I think you want to include the macro variable &i in your do loop.
I.e., %do %until (&i.=1);
Second, I think you want to either pass in the macro variable &today when
you call the macro, or you want to use the system 'today' function, as well
as use let to change the value of the macro variable &i. E.g.:
data _null_;
set testdatabase;
if process_date = today() then do;
%let i = 1;
end;
run;
HTH,
Art
--------
On Thu, 25 Jun 2009 14:46:15 -0700, Paul Lambson <paullambson@GMAIL.COM>
wrote:
>I have in the past worked with do loop macros. Now I am trying to
>recreate one by memory, it's not working very well. There are a few
>things I need help with.
>
>My IF statement needs to declare i = to 0 or 1 on a macro level?
>
>and I need to put a sleep statement in there before it loops again.
>
>As always, thanks for any help.
>
>Paul
>
>%macro Pdate_check;
>%let i=0;
>%do %until (i=1);
>proc sql;
>connect to odbc (dsn=PostgreSQL30 user=bgadmin password=jad#jax*Ku);
>create table testdatabase as
>select * from connection to odbc
>(select max(process_date_id) as process_date
>from leg_compartment);
>quit;
>
>data _null_;
>set testdatabase;
>if process_date = &today then i = 1; else i = 0;
>run;
>
>%end;
>%mend;
>
>%Pdate_check;
|