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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help with the SAS Code

Status
Not open for further replies.

vundela

Programmer
Dec 19, 2006
2
US
Hi,

I have a stored procedure in SQL. I am calling that stored procedure using Proc SQl.Below is the sample code of how I did.

proc SQl;

Connect to ODBC(DSN=***** UID=**** password=***);

create table Work.list1
as
select * from connection to odbc(SampleProgram '2006-12-10','2006-12-16');

quit;

Right now I am mentioning the dates in the SAS code. But I want to pass those date parameters thru a batch program or any means.
can any body help me please....

Thank You
Neelima
 
From SAS the only way to send these 'static' date ranges is by having SAS generate a macro variable.

Take your code (for example);
Code:
%let startdate ='2006-12-10';
%let enddate   = '2006-12-16';
proc SQl;
  Connect to ODBC(DSN=***** UID=**** password=***);
  create table Work.list1 as
  select * from connection to odbc(SampleProgram &startdate,&enddate);
quit;

The reason I have included the single quotes on the macro var is that your SP expects single quotes and using the double quotes really messes with the sp engine.

Of course you can have another process generate that macro value.

Let me know if this helps you.
Klaz
 
Hi,

Thank you for guiding me. I have a batch program thru which I am passing the date values to the sas program like below
"C:\Program Files\SAS\SAS 9.1\sas.exe" -sysin "xxx:\vvvv\sas\files\samplesas.sas" -sysparm "01JUN06 02JUN06" -PRINT "C:\Program Files\SAS\SAS 9.1\leadsas.TXT" -log "C:\Program Files\SAS\SAS 9.1\LEADSAS.log"

so can I refer these dates in the macro variables like this
%let startdate ="%scan(&sysparm,1)"d;
%let enddate = "%scan(&sysparm,2)"d;

Thank You
Neelima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top