Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditonal Logic for proc sql?? 1

Status
Not open for further replies.

PRUSA

Technical User
Sep 23, 2004
35
0
0
US
Hi Everyone,

I'm very new to SAS and i'm running into a problem. I'm doing a proc sql and in it i'm doing a left join. It turns out once quarter my driver table will contain less rows than the right table causing rows to be chopped off

I was wondering if this was possible, and what the syntax would be:

Example

If DateA > Date B then do;

proc sql
query 1
quit;
end;
else do;

pro sql
query 2
quit;
end;


any help woudl be much appreciated

-Sergio
 
You need to use macro code to do that.
Code:
data _null_;
  if today() = '01NOV2001'd then
    call symput('QUART','1');
  else call symput('QUART','0');
run;

%macro blah;
  %if &QUART = 1 %then
  %do;
    proc sql;
        query1
        ;
    quit;
  %else
  %do;
    proc sql;
        query2
        ;
    quit;
  %end;
%mend blah;

%blah;


Chris
Business Analyst, Code Monkey, Data Wrangler.
SAS Guru.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top