The Daily WTF
C. Wiles has the “joy” of working on a SAS application for a large health insurance company. This snippet was extracted some time ago, but the application continues to live on. It has one job: pad the month part of dates to two digits. Let’s see how it’s done.
%macro yearmonth; if year_month = ‘2010-1’ then year_month = ‘2010-01’; else if year_month = ‘2010-2’ then year_month = ‘2010-02’; else if year_month = ‘2010-3’ then year_month = ‘2010-03’; else if year_month = ‘2010-4’ then year_month = ‘2010-04’; else if year_month = ‘2010-5’ then year_month = ‘2010-05’; else if year_month = ‘2010-6’ then year_month = ‘2010-06’; else if year_month = ‘2010-7’ then year_month = ‘2010-07’; else if year_month = ‘2010-8’ then year_month = ‘2010-08’; else if year_month = ‘2010-9’ then year_month = ‘2010-09’; else if year_month = ‘2010-10’ then year_month = ‘2010-10’; else if year_month = ‘2010-11’ then year_month = ‘2010-11’; else
To read the full article click on the 'post' link at the top.