Code: Program data test; infile cards expandtabs; input id:$15. (Start End)(:mmddyy.); format start end mmddyy.; cards; 40000000337C00 4/1/2014 5/31/2015 40000000522C00 5/1/2014 5/31/2015 40000000665C00 12/1/2014 5/31/2015 ;;;; run; data want; set test; do i=start to end; month=month(i); if month ne lag(month) or i=start then output; end; format i monyy7.; drop month start end; run; proc print;run; Results: Program 1 40000000337C00 APR2014 2 40000000337C00 MAY2014 3 40000000337C00 JUN2014 4 40000000337C00 JUL2014 5 40000000337C00 AUG2014 6 40000000337C00 SEP2014 7 40000000337C00 OCT2014 8 40000000337C00 NOV2014 9 40000000337C00 DEC2014 10 40000000337C00 JAN2015 11 40000000337C00 FEB2015 12 40000000337C00 MAR2015 13 40000000337C00 APR2015 14 40000000337C00 MAY2015 15 40000000522C00 MAY2014 16 40000000522C00 JUN2014 17 40000000522C00 JUL2014 18 40000000522C00 AUG2014 19 40000000522C00 SEP2014 20 40000000522C00 OCT2014 21 40000000522C00 NOV2014 22 40000000522C00 DEC2014 23 40000000522C00 JAN2015 24 40000000522C00 FEB2015 25 40000000522C00 MAR2015 26 40000000522C00 APR2015 27 40000000522C00 MAY2015 28 40000000665C00 DEC2014 29 40000000665C00 JAN2015 30 40000000665C00 FEB2015 31 40000000665C00 MAR2015 32 40000000665C00 APR2015 33 40000000665C00 MAY2015 Xia Keshan
... View more