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

How to convert SAS logic into a Oracle SQL syntax?

Status
Not open for further replies.

estersita

Technical User
Aug 5, 2004
50
US
How to convert SAS logic into a Oracle SQL syntax?

Hi Experts,
Having below algorithm in SAS I am struggling to build a code in Oracle SQL.

Could you please help me with code?

Thank you!
Estersita

--This is what I have in SAS
data mytable;
set have;
elig.DTE_Effective < to_date('01MAR2018') then elig.DTE_Effective=to_date('01MAR2018');
else if elig.DTE_Effective > to_date('30JUN2018') then elig.DTE_Effective=elig.DTE_End;
elig.DTE_END < to_date('01MAR2018') then elig.DTE_END=to_date('01MAR2018');
else if elig.DTE_END > to_date('30JUN2018') then elig.DTE_END=to_date('30JUN2018');

num_days_elig2 = datdif(datepart(dte_effective), datepart(dte_end), 'ACT/ACT') + 1;
run;

--This is what I am trying to do in SQL
CREATE TABLE mytable as
SELECT DISTINCT
Field 1.
Field2,
/*case conditions*/
/*calc line*/
FROM have
quit;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top