02-15-2017 01:27 PM
I am trying to convert SAS code to SQL.
first step is to get precode converted properly.
Need help in converting below code to SQL.I think we will need to have global parameters in SQL code.Corect me if i am wrong.
Here is the sas code:
%LET RUNOUT = 0;
%LET PERIODS = 4;
%let ENRLMNTDY = 15;
%LET RUN_DATE = %SYSFUNC(TODAY());
%LET START_DATE = %SYSFUNC(INTNX(MONTH, &RUN_DATE.,%EVAL(-12*&PERIODS.-&RUNOUT.),B));
%LET END_DATE = %SYSFUNC(INTNX(MONTH, &RUN_DATE.,%EVAL(-1-&RUNOUT.),E));
02-15-2017 02:08 PM - edited 02-15-2017 02:10 PM
It depends on how it's used in the code. If there are no loops but just filters then you may not need them, but otherwise you may.
Edit: Remember that its better if you don't do a line to line conversion for code, determine the purpose and figure out how to replicate this in SQL. I'm assuming you're not using SAS SQL but MS SQL or Oracle SQL?