Morning,
Not sure if this is at all possible, however i shall explain:
Our SAS programmer has decided to leave, and joy of joys i get to pick up where he left off. However, i don't use SAS and would rather use SQL (as its what i know best).
Question: Is there a programmatical way to convert SAS code into SQL code?
I can get definitions for SAS, but going through 1000's of lines of code and changing it to SQL by hand is going to take longer than i have.
Example:
SAS code:
Code:
procsql;
createtable cartesian_case_controls
asselect a.pracid, a.patid, a.dob, a.sex, a.index_date,
b.control_matchid, b.control_patid, b.control_sex, b.control_dob, b.control_regdate, b.control_xferdate, b.control_regstat
from case_population as a, potential_control_population1 as b
where a.pracid = b.control_matchid and a.sex = b.control_sex and 0 le abs(a.dob - b.control_dob) le 1096 and
b.control_regdate le a.index_date - 180 and b.control_regdate ne .and(b.control_xferdate ge a.index_date or b.control_xferdate eq .);
quit;
What it is when converted:
Code:
select a.pracid, a.patid, a.dob, a.sex, a.index_date, b.control_matchid, b.control_patid,
b.control_sex, b.control_dob, b.control_regdate, b.control_xferdate, b.control_regstat
from case_population as a, potential_control_population1 as b
where a.pracid = b.control_matchid and a.sex = b.control_sex and 0 <=abs(a.dob - b.control_dob)andabs(a.dob - b.control_dob)<= 1096
and b.control_regdate <=(a.index_date -180)and b.control_regdate isnotnull
and(b.control_xferdate >= a.index_date or b.control_xferdate isnull)
INSERTINTO cartesian_case_controls;
Note: Not all of the SAS code is 'Proc SQL' which makes it alot more difficult.
If anyone has some insite, just an idea of what might work (As i've never done conversions such as this). Or if anyone has come across the problem before, and has an idea of how they overcame this (even if it is just to start from scratch!)
I can give more information if needed, but i think that it's all above.
Many thanks in advance.
Rixxe