I am not a blogger, but I have been using SAS for about six years. Let me know if there is a better forum for this question.

Can you help me optimize these variables?

I just recently took the Macro Language class and I am very familiar with SQL. I am converting others code and trying to optomize the macro variables used within the code.

We do our reporting of data based on the previous month on data with effective dating. If I use SQL, the dates are in one format, if data step, they must be in the datetime, if used as part of a file name, they are in yet another format. How best can I use today's date to create all the variables I need for my process without rewriting all the code?

The following code is used throughout the process. We are looking at last month as a report month and looking a one year's worth of data.

/* ---------------------------------------------------------------------------------- */
/* January 2013 */
/* ---------------------------------------------------------------------------------- */
/* MC_RE_Passthrough */
%LET BEGMonth = 01;
%LET YEAR = 2013;

LIBNAME ONE 'C:\TBD\&year.&BEGMonth';
LIBNAME TWO 'C:\QR7\&year.&BEGMonth';

/* Data Clean-up RE and Data Clean-up QR */
%LET CURMONTH='01JAN2013'd; /* Report Month. */
/* Web Report - RE and QR */
%LET RMonth=January; /* Report Month in words */
%let BACK6 = -6;

/* All Graphs RE and All Graphs QR */
%LET FUTR6MON='01FEB2013'd; /* Six months in the future. Remains at Feb 2013 until 6 months have passed.*/
%LET FRST6MON='01AUG2012'd; /* First overall report month of six. Remains at Aug until Feb 2013 */
%LET L12MONTH='01DEC2012'd; /* Ending of 12 months; current redetermination due month. */
%LET B12MONTH='01JAN2012'd; /* Beginning of 12 months; first reporting month. */

/* QR7_Submit_Status */
%LET EFF_FDay ='01Dec2012:0:0:0'dt; /* Effective Month = Reports DUE in Month of */
%LET EFF_FDaySQL ='12/01/2012'; /* Report Month */

/* Reporting Month */
%LET FDaySQL ='01/01/2013'; /* First Day of the Month in which you're reporting */
%LET FDayFSQL ='02/01/2013'; /* First Day FOLLOWING the Month in which you're reporting */
%LET FDay ='01Jan2013:0:0:0'dt;
%LET FDayF ='01Feb2013:0:0:0'dt;
/* Beginning Day of the Past 12 month period. This period of time is > Begin Month and < FDaySQL. */
%LET BeginMonth ='01Jan2012:0:0:0'dt;