<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Arrays in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/609661#M17935</link>
    <description>&lt;P&gt;I've used a different approach, with a do loop to read the groups and a hash to store values:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID Stage ECL Nemo_date :date9. run_date :datetime16.;
format nemo_date e8601da10. run_date e8601dt19.;
month = put(nemo_date,monname.);
datalines;
113 2 20.46635874 31DEC2018 03JAN19:06:10:18
253 2 151.89921902 31DEC2018 03JAN19:06:10:18
254 2 752.1434742 31DEC2018 03JAN19:06:10:18
424 2 381.95786399 31DEC2018 03JAN19:06:10:18
467 1 54.242825626 31DEC2018 03JAN19:06:10:18
509 1 140.80432621 31DEC2018 03JAN19:06:10:18
585 1 46.757903196 31DEC2018 03JAN19:06:10:18
618 3 17838.516473 31DEC2018 03JAN19:06:10:18
646 1 1.4027319654 31DEC2018 03JAN19:06:10:18
654 1 1.9729897596 31DEC2018 03JAN19:06:10:18
767 2 937.15402091 31DEC2018 03JAN19:06:10:18
1606 2 2104.617633 31DEC2018 03JAN19:06:10:18
4745 1 45.034218874 31DEC2018 03JAN19:06:10:18
4750 2 1446.589353 31DEC2018 03JAN19:06:10:18
4769 3 646.00385791 31DEC2018 03JAN19:06:10:18
4964 2 2474.8923119 31DEC2018 03JAN19:06:10:18
5585 1 62.472567841 31DEC2018 03JAN19:06:10:18
5601 2 23.422928663 31DEC2018 03JAN19:06:10:18
5608 1 7.3550760663 31DEC2018 03JAN19:06:10:18
6993 1 11.525864308 31DEC2018 03JAN19:06:10:18
7267 2 310.49225779 31DEC2018 03JAN19:06:10:18
7793 1 35.583162036 31DEC2018 03JAN19:06:10:18
8160 2 721.89526909 31DEC2018 03JAN19:06:10:18
8691 1 30.852079096 31DEC2018 03JAN19:06:10:18
8758 1 65.400469942 31DEC2018 03JAN19:06:10:18
113 2 240.49996134 31JAN2019 04FEB19:06:04:44
253 2 155.11089521 31JAN2019 04FEB19:06:04:44
254 2 721.96348394 31JAN2019 04FEB19:06:04:44
424 2 341.78684957 31JAN2019 04FEB19:06:04:44
467 1 54.550273923 31JAN2019 04FEB19:06:04:44
509 1 124.59797166 31JAN2019 04FEB19:06:04:44
585 1 44.10680372 31JAN2019 04FEB19:06:04:44
618 3 17679.125664 31JAN2019 04FEB19:06:04:44
646 1 1.3698129378 31JAN2019 04FEB19:06:04:44
654 1 1.949665947 31JAN2019 04FEB19:06:04:44
767 2 948.03214347 31JAN2019 04FEB19:06:04:44
1606 2 1528.6456431 31JAN2019 04FEB19:06:04:44
4745 1 45.086359956 31JAN2019 04FEB19:06:04:44
4750 2 1446.3113241 31JAN2019 04FEB19:06:04:44
4769 3 480.34155366 31JAN2019 04FEB19:06:04:44
4964 2 532.11561229 31JAN2019 04FEB19:06:04:44
5585 1 62.708936525 31JAN2019 04FEB19:06:04:44
5601 2 23.093829755 31JAN2019 04FEB19:06:04:44
5608 2 35.909272836 31JAN2019 04FEB19:06:04:44
6993 2 129.07495746 31JAN2019 04FEB19:06:04:44
7267 2 284.17950282 31JAN2019 04FEB19:06:04:44
7793 1 35.969572076 31JAN2019 04FEB19:06:04:44
8160 2 698.32435668 31JAN2019 04FEB19:06:04:44
8691 1 30.875200259 31JAN2019 04FEB19:06:04:44
8758 1 47.969477628 31JAN2019 04FEB19:06:04:44
113 2 16.17325128 28FEB2019 04MAR19:10:55:37
253 2 155.02485146 28FEB2019 04MAR19:10:55:37
254 2 698.32046477 28FEB2019 04MAR19:10:55:37
424 2 324.54996467 28FEB2019 04MAR19:10:55:37
467 1 54.117136661 28FEB2019 04MAR19:10:55:37
509 1 210.55762424 28FEB2019 04MAR19:10:55:37
585 1 43.655356565 28FEB2019 04MAR19:10:55:37
618 3 17801.735267 28FEB2019 04MAR19:10:55:37
646 1 1.3367078621 28FEB2019 04MAR19:10:55:37
654 1 1.9274254292 28FEB2019 04MAR19:10:55:37
767 2 951.17844566 28FEB2019 04MAR19:10:55:37
1606 1 75.505580522 28FEB2019 04MAR19:10:55:37
4745 1 45.089995284 28FEB2019 04MAR19:10:55:37
4750 2 1367.4504408 28FEB2019 04MAR19:10:55:37
4769 3 440.34153363 28FEB2019 04MAR19:10:55:37
4964 2 503.74666827 28FEB2019 04MAR19:10:55:37
5585 2 1110.0488989 28FEB2019 04MAR19:10:55:37
5601 2 21.868959551 28FEB2019 04MAR19:10:55:37
5608 2 34.426697678 28FEB2019 04MAR19:10:55:37
6993 2 127.30398963 28FEB2019 04MAR19:10:55:37
7267 2 305.92524322 28FEB2019 04MAR19:10:55:37
7793 1 55.378558197 28FEB2019 04MAR19:10:55:37
8160 2 580.95872292 28FEB2019 04MAR19:10:55:37
8691 1 30.551538243 28FEB2019 04MAR19:10:55:37
8758 1 47.389386568 28FEB2019 04MAR19:10:55:37
113 2 15.455339675 31MAR2019 02APR19:09:55:12
253 2 153.6376364 31MAR2019 02APR19:09:55:12
254 2 436.75464466 31MAR2019 02APR19:09:55:12
424 2 328.88999593 31MAR2019 02APR19:09:55:12
467 1 54.06840136 31MAR2019 02APR19:09:55:12
509 1 209.68873825 31MAR2019 02APR19:09:55:12
585 1 48.262906991 31MAR2019 02APR19:09:55:12
618 3 18545.164686 31MAR2019 02APR19:09:55:12
646 1 1.3026264259 31MAR2019 02APR19:09:55:12
654 1 1.9037712007 31MAR2019 02APR19:09:55:12
767 2 942.91600294 31MAR2019 02APR19:09:55:12
1606 1 75.221661897 31MAR2019 02APR19:09:55:12
4745 1 44.63536115 31MAR2019 02APR19:09:55:12
4750 2 1324.9215109 31MAR2019 02APR19:09:55:12
4769 3 400.54048913 31MAR2019 02APR19:09:55:12
4964 2 463.90847202 31MAR2019 02APR19:09:55:12
5585 2 1090.61798 31MAR2019 02APR19:09:55:12
5601 2 21.538505057 31MAR2019 02APR19:09:55:12
5608 2 30.623114891 31MAR2019 02APR19:09:55:12
6993 2 127.83681755 31MAR2019 02APR19:09:55:12
7267 2 647.556714 31MAR2019 02APR19:09:55:12
7793 2 923.28376445 31MAR2019 02APR19:09:55:12
8160 2 571.94510683 31MAR2019 02APR19:09:55:12
8691 2 338.56100037 31MAR2019 02APR19:09:55:12
8758 1 54.048513995 31MAR2019 02APR19:09:55:12
113 1 4.0449254499 30APR2019 02MAY19:06:46:31
253 2 152.8092591 30APR2019 02MAY19:06:46:31
254 2 418.04376465 30APR2019 02MAY19:06:46:31
424 2 192.50580059 30APR2019 02MAY19:06:46:31
467 1 54.564550877 30APR2019 02MAY19:06:46:31
509 1 139.52081795 30APR2019 02MAY19:06:46:31
585 1 45.55006243 30APR2019 02MAY19:06:46:31
618 3 18274.54589 30APR2019 02MAY19:06:46:31
646 1 1.2683902722 30APR2019 02MAY19:06:46:31
654 1 1.8789628501 30APR2019 02MAY19:06:46:31
767 2 950.30332959 30APR2019 02MAY19:06:46:31
1606 1 75.310122205 30APR2019 02MAY19:06:46:31
4745 1 44.196374976 30APR2019 02MAY19:06:46:31
4750 2 1408.754366 30APR2019 02MAY19:06:46:31
4769 3 359.25765399 30APR2019 02MAY19:06:46:31
4964 2 464.86078609 30APR2019 02MAY19:06:46:31
5585 1 69.504351582 30APR2019 02MAY19:06:46:31
5601 2 21.213528117 30APR2019 02MAY19:06:46:31
5608 1 6.1912479615 30APR2019 02MAY19:06:46:31
6993 1 9.4697554824 30APR2019 02MAY19:06:46:31
7267 3 932.42841018 30APR2019 02MAY19:06:46:31
7793 2 919.04027491 30APR2019 02MAY19:06:46:31
8160 2 543.09012667 30APR2019 02MAY19:06:46:31
8691 2 346.17309912 30APR2019 02MAY19:06:46:31
8758 2 2110.6137662 30APR2019 02MAY19:06:46:31
113 1 3.8470308639 31MAY2019 04JUN19:06:05:27
253 2 152.24488404 31MAY2019 04JUN19:06:05:27
254 2 96.472817121 31MAY2019 04JUN19:06:05:27
424 2 181.58456792 31MAY2019 04JUN19:06:05:27
467 1 54.511114679 31MAY2019 04JUN19:06:05:27
509 1 140.29130872 31MAY2019 04JUN19:06:05:27
585 1 45.363627847 31MAY2019 04JUN19:06:05:27
618 3 18320.62846 31MAY2019 04JUN19:06:05:27
646 1 1.2343272924 31MAY2019 04JUN19:06:05:27
654 1 0.8367411553 31MAY2019 04JUN19:06:05:27
767 1 57.802943883 31MAY2019 04JUN19:06:05:27
1606 1 75.240692902 31MAY2019 04JUN19:06:05:27
4745 2 340.07494723 31MAY2019 04JUN19:06:05:27
4750 2 1432.1627042 31MAY2019 04JUN19:06:05:27
4769 3 319.62745817 31MAY2019 04JUN19:06:05:27
4964 2 80.042090186 31MAY2019 04JUN19:06:05:27
5585 1 70.153092208 31MAY2019 04JUN19:06:05:27
5601 2 19.893539384 31MAY2019 04JUN19:06:05:27
5608 1 5.8871740643 31MAY2019 04JUN19:06:05:27
6993 1 9.4764960671 31MAY2019 04JUN19:06:05:27
7267 3 839.53572683 31MAY2019 04JUN19:06:05:27
7793 2 930.65908395 31MAY2019 04JUN19:06:05:27
8160 2 317.48985802 31MAY2019 04JUN19:06:05:27
8691 2 339.47107599 31MAY2019 04JUN19:06:05:27
8758 2 2095.9581339 31MAY2019 04JUN19:06:05:27
113 1 3.6418345703 30JUN2019 02JUL19:06:05:38
253 2 160.12555809 30JUN2019 02JUL19:06:05:38
254 2 61.848902557 30JUN2019 02JUL19:06:05:38
424 2 26.761118389 30JUN2019 02JUL19:06:05:38
467 1 53.970798759 30JUN2019 02JUL19:06:05:38
509 1 187.45534321 30JUN2019 02JUL19:06:05:38
585 1 54.725424189 30JUN2019 02JUL19:06:05:38
618 3 20168.828415 30JUN2019 02JUL19:06:05:38
646 1 1.1992606443 30JUN2019 02JUL19:06:05:38
654 1 0.825480982 30JUN2019 02JUL19:06:05:38
767 1 57.680725363 30JUN2019 02JUL19:06:05:38
1606 1 74.822719867 30JUN2019 02JUL19:06:05:38
4745 1 44.711332938 30JUN2019 02JUL19:06:05:38
4750 2 1464.3554442 30JUN2019 02JUL19:06:05:38
4769 3 278.45015971 30JUN2019 02JUL19:06:05:38
4964 1 26.490212655 30JUN2019 02JUL19:06:05:38
5585 1 69.711452467 30JUN2019 02JUL19:06:05:38
5601 1 8.7862523847 30JUN2019 02JUL19:06:05:38
5608 1 5.593929793 30JUN2019 02JUL19:06:05:38
6993 1 9.7424458438 30JUN2019 02JUL19:06:05:38
7267 3 806.460993 30JUN2019 02JUL19:06:05:38
7793 1 34.881156703 30JUN2019 02JUL19:06:05:38
8160 2 294.48216574 30JUN2019 02JUL19:06:05:38
8691 2 403.99829041 30JUN2019 02JUL19:06:05:38
8758 2 1803.742407 30JUN2019 02JUL19:06:05:38
113 1 2.6549385876 31JUL2019 02AUG19:16:50:19
253 2 157.42715684 31JUL2019 02AUG19:16:50:19
254 2 61.998629457 31JUL2019 02AUG19:16:50:19
424 2 25.775131808 31JUL2019 02AUG19:16:50:19
467 1 48.282332772 31JUL2019 02AUG19:16:50:19
509 1 194.36599843 31JUL2019 02AUG19:16:50:19
585 1 54.96598957 31JUL2019 02AUG19:16:50:19
618 3 20277.07267 31JUL2019 02AUG19:16:50:19
646 1 1.1660095295 31JUL2019 02AUG19:16:50:19
654 1 0.816212787 31JUL2019 02AUG19:16:50:19
767 1 58.813896642 31JUL2019 02AUG19:16:50:19
1606 1 74.760867439 31JUL2019 02AUG19:16:50:19
4745 1 45.038912917 31JUL2019 02AUG19:16:50:19
4750 2 1452.9679391 31JUL2019 02AUG19:16:50:19
4769 3 238.75411445 31JUL2019 02AUG19:16:50:19
4964 1 24.961828428 31JUL2019 02AUG19:16:50:19
5585 1 69.288600621 31JUL2019 02AUG19:16:50:19
5601 1 4.1644956019 31JUL2019 02AUG19:16:50:19
5608 1 5.2849642108 31JUL2019 02AUG19:16:50:19
6993 1 10.181067742 31JUL2019 02AUG19:16:50:19
7267 3 739.94688823 31JUL2019 02AUG19:16:50:19
7793 1 34.65632422 31JUL2019 02AUG19:16:50:19
8160 2 290.25039061 31JUL2019 02AUG19:16:50:19
8691 2 377.06214226 31JUL2019 02AUG19:16:50:19
8758 1 57.388223251 31JUL2019 02AUG19:16:50:19
113 1 2.498374817 31AUG2019 03SEP19:06:03:59
253 2 154.0248261 31AUG2019 03SEP19:06:03:59
254 2 58.437238802 31AUG2019 03SEP19:06:03:59
424 2 24.784432624 31AUG2019 03SEP19:06:03:59
467 1 47.583156548 31AUG2019 03SEP19:06:03:59
509 1 191.30969635 31AUG2019 03SEP19:06:03:59
585 1 54.229450445 31AUG2019 03SEP19:06:03:59
618 3 20157.98234 31AUG2019 03SEP19:06:03:59
646 1 0.8665982543 31AUG2019 03SEP19:06:03:59
654 1 0.615770443 31AUG2019 03SEP19:06:03:59
767 2 1097.0267945 31AUG2019 03SEP19:06:03:59
1606 1 74.03140867 31AUG2019 03SEP19:06:03:59
4745 1 44.304237099 31AUG2019 03SEP19:06:03:59
4750 2 1427.8077712 31AUG2019 03SEP19:06:03:59
4769 3 199.39725914 31AUG2019 03SEP19:06:03:59
4964 1 15.928808007 31AUG2019 03SEP19:06:03:59
5585 1 54.928719219 31AUG2019 03SEP19:06:03:59
5601 1 1.9629287156 31AUG2019 03SEP19:06:03:59
5608 1 4.9646328374 31AUG2019 03SEP19:06:03:59
6993 1 10.031212961 31AUG2019 03SEP19:06:03:59
7267 3 718.86098203 31AUG2019 03SEP19:06:03:59
7793 1 33.709684375 31AUG2019 03SEP19:06:03:59
8160 2 256.46773173 31AUG2019 03SEP19:06:03:59
8691 1 30.810728605 31AUG2019 03SEP19:06:03:59
8758 1 55.891715427 31AUG2019 03SEP19:06:03:59
113 1 2.3401166492 30SEP2019 02OCT19:06:04:18
253 2 149.71808117 30SEP2019 02OCT19:06:04:18
254 2 44.71783757 30SEP2019 02OCT19:06:04:18
424 2 18.43758187 30SEP2019 02OCT19:06:04:18
467 1 47.676676852 30SEP2019 02OCT19:06:04:18
509 1 179.53382655 30SEP2019 02OCT19:06:04:18
585 1 52.508030701 30SEP2019 02OCT19:06:04:18
618 3 19910.412559 30SEP2019 02OCT19:06:04:18
646 1 0.8397733242 30SEP2019 02OCT19:06:04:18
654 1 0.6076028241 30SEP2019 02OCT19:06:04:18
767 1 56.146690413 30SEP2019 02OCT19:06:04:18
1606 1 73.258886966 30SEP2019 02OCT19:06:04:18
4745 1 42.330887963 30SEP2019 02OCT19:06:04:18
4750 1 50.122647433 30SEP2019 02OCT19:06:04:18
4769 3 161.07842496 30SEP2019 02OCT19:06:04:18
4964 2 85.229406126 30SEP2019 02OCT19:06:04:18
5585 1 80.969716246 30SEP2019 02OCT19:06:04:18
5601 1 1.2955587086 30SEP2019 02OCT19:06:04:18
5608 1 4.6592669782 30SEP2019 02OCT19:06:04:18
6993 1 9.1523100492 30SEP2019 02OCT19:06:04:18
7267 2 635.57314495 30SEP2019 02OCT19:06:04:18
7793 1 33.075006361 30SEP2019 02OCT19:06:04:18
8160 2 234.84678153 30SEP2019 02OCT19:06:04:18
8691 1 28.405145457 30SEP2019 02OCT19:06:04:18
8758 1 47.392984462 30SEP2019 02OCT19:06:04:18
113 1 1.4934923608 31OCT2019 04NOV19:06:04:17
253 2 147.43531714 31OCT2019 04NOV19:06:04:17
254 2 29.85236368 31OCT2019 04NOV19:06:04:17
424 2 17.6225397 31OCT2019 04NOV19:06:04:17
467 1 47.509646815 31OCT2019 04NOV19:06:04:17
509 1 180.38860567 31OCT2019 04NOV19:06:04:17
585 1 51.819886666 31OCT2019 04NOV19:06:04:17
618 3 19906.248261 31OCT2019 04NOV19:06:04:17
646 1 0.8131099221 31OCT2019 04NOV19:06:04:17
654 1 0.5990375342 31OCT2019 04NOV19:06:04:17
767 1 55.752171141 31OCT2019 04NOV19:06:04:17
1606 1 72.703588822 31OCT2019 04NOV19:06:04:17
4745 1 41.822827446 31OCT2019 04NOV19:06:04:17
4750 1 49.4281835 31OCT2019 04NOV19:06:04:17
4769 2 121.30741193 31OCT2019 04NOV19:06:04:17
4964 1 22.321415208 31OCT2019 04NOV19:06:04:17
5585 1 36.881990209 31OCT2019 04NOV19:06:04:17
5601 1 1.272046705 31OCT2019 04NOV19:06:04:17
5608 1 4.3474306069 31OCT2019 04NOV19:06:04:17
6993 1 9.0944832076 31OCT2019 04NOV19:06:04:17
7267 2 656.02905222 31OCT2019 04NOV19:06:04:17
7793 1 17.126170637 31OCT2019 04NOV19:06:04:17
8160 2 236.30757553 31OCT2019 04NOV19:06:04:17
8691 1 28.30618198 31OCT2019 04NOV19:06:04:17
8758 1 54.684903158 31OCT2019 04NOV19:06:04:17
113 1 1.383013089 30NOV2019 03DEC19:09:04:37
253 2 147.83478255 30NOV2019 03DEC19:09:04:37
254 2 27.863723732 30NOV2019 03DEC19:09:04:37
424 2 16.831105784 30NOV2019 03DEC19:09:04:37
467 1 47.380406535 30NOV2019 03DEC19:09:04:37
509 1 206.10572211 30NOV2019 03DEC19:09:04:37
585 1 51.517863612 30NOV2019 03DEC19:09:04:37
618 3 19919.488195 30NOV2019 03DEC19:09:04:37
646 1 0.5350457603 30NOV2019 03DEC19:09:04:37
654 1 0.8911858103 30NOV2019 03DEC19:09:04:37
767 2 1129.7818647 30NOV2019 03DEC19:09:04:37
1606 2 2321.6419581 30NOV2019 03DEC19:09:04:37
4745 1 43.140229652 30NOV2019 03DEC19:09:04:37
4750 1 50.863402634 30NOV2019 03DEC19:09:04:37
4769 2 5.315273714 30NOV2019 03DEC19:09:04:37
4964 2 67.044439404 30NOV2019 03DEC19:09:04:37
5585 1 36.527428583 30NOV2019 03DEC19:09:04:37
5601 1 0.9539986273 30NOV2019 03DEC19:09:04:37
5608 1 4.0439109935 30NOV2019 03DEC19:09:04:37
6993 1 8.9655147898 30NOV2019 03DEC19:09:04:37
7267 2 620.49757145 30NOV2019 03DEC19:09:04:37
7793 1 16.896373249 30NOV2019 03DEC19:09:04:37
8160 2 220.08648564 30NOV2019 03DEC19:09:04:37
8691 1 27.894940809 30NOV2019 03DEC19:09:04:37
8758 1 54.371032858 30NOV2019 03DEC19:09:04:37
;

proc sort data=have;
by id nemo_date;
run;

proc transpose data=have out=trans (drop=_name_);
by id;
var stage;
id month;
run;

data want;
set trans; /* get the wide dataset */
length
  month $9
  count revised overlay 8
;
if _n_ = 1
then do;
  declare hash lookup();
  lookup.definekey('count');
  lookup.definedata('revised','month');
  lookup.definedone();
end;
lookup.clear();
count = 0;
do until (last.id);
  set have;
  by id;
  count + 1;
  if not last.id
  then do;
    if month2 = . and stage = 2 then month2 = count;
    if month3 = . and stage = 3 then month3 = count;
    revised = ecl;
    month = put(nemo_date,monname.);
    rc = lookup.add();
  end;
end;
revised = .;
month = '';
/* we now have the last observation for a given ID in the PDV */
select (stage);
  when (1) if month2 ne . or month3 ne .
    then do;
      count = min(month2,month3);
      rc = lookup.find(); /* retrieves revised, month for earliest switch to 2 or 3 */
    end;
  when (2) if month3 ne .
    then do;
      rc = lookup.find(key:month3); /* retrieves revised, month for month3 */
    end;
  when (3) month = '';
end;
overlay = revised - ecl;
drop count month2 month3 rc stage ecl nemo_date run_date;
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result (column names omitted because they use too much space):&lt;/P&gt;
&lt;PRE&gt;113 2 2 2 2 1 1 1 1 1 1 1 1 December 20.47 19.08 
253 2 2 2 2 2 2 2 2 2 2 2 2   . . 
254 2 2 2 2 2 2 2 2 2 2 2 2   . . 
424 2 2 2 2 2 2 2 2 2 2 2 2   . . 
467 1 1 1 1 1 1 1 1 1 1 1 1   . . 
509 1 1 1 1 1 1 1 1 1 1 1 1   . . 
585 1 1 1 1 1 1 1 1 1 1 1 1   . . 
618 3 3 3 3 3 3 3 3 3 3 3 3   . . 
646 1 1 1 1 1 1 1 1 1 1 1 1   . . 
654 1 1 1 1 1 1 1 1 1 1 1 1   . . 
767 2 2 2 2 2 1 1 1 2 1 1 2   . . 
1606 2 2 1 1 1 1 1 1 1 1 1 2   . . 
4745 1 1 1 1 1 2 1 1 1 1 1 1 May 340.07 296.93 
4750 2 2 2 2 2 2 2 2 2 1 1 1 December 1446.59 1395.73 
4769 3 3 3 3 3 3 3 3 3 3 2 2 December 646.00 640.69 
4964 2 2 2 2 2 2 1 1 1 2 1 2   . . 
5585 1 1 2 2 1 1 1 1 1 1 1 1 February 1110.05 1073.52 
5601 2 2 2 2 2 2 1 1 1 1 1 1 December 23.42 22.47 
5608 1 2 2 2 1 1 1 1 1 1 1 1 January 35.91 31.87 
6993 1 2 2 2 1 1 1 1 1 1 1 1 January 129.07 120.11 
7267 2 2 2 2 3 3 3 3 3 2 2 2 April 932.43 311.93 
7793 1 1 1 2 2 2 1 1 1 1 1 1 March 923.28 906.39 
8160 2 2 2 2 2 2 2 2 2 2 2 2   . . 
8691 1 1 1 2 2 2 2 2 1 1 1 1 March 338.56 310.67 
8758 1 1 1 1 2 2 2 1 1 1 1 1 April 2110.61 2056.24 
&lt;/PRE&gt;</description>
    <pubDate>Thu, 05 Dec 2019 12:45:51 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-12-05T12:45:51Z</dc:date>
    <item>
      <title>Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608691#M17736</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;


options symbolgen mlogic mprint;
data nemo_test;
set nemo_stg_lmth;
array mth(11) &amp;amp;dt_nm;
if mth(11) = 3 then
Month = " ";
else if mth(11) = 2 then
do;
do i = 1 to 10;
if mth(i) = 3 then
do;
Month = i; leave;
end; end; end;
else;
if mth(11) = 1 then
do;
do i = 1 to 10;
if mth(i) = 3 then
do;
Month = i; leave;
end; end;
if Month = "" then 
do;
do i = 1 to 10;
if mth(i) = 2 then
do;
Month = i; leave;
end; end; end; end;
if Month NE "" then
S_Month = vname(mth(Month));
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
      29:4    31:9    34:4    39:4    42:4    49:4    54:21   
NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
      36:9   44:9   51:9   
NOTE: Invalid character data, i=10.00 , at line 51 column 9.
NOTE: Invalid numeric data, Month='*' , at line 54 column 21.
ERROR: Array subscript out of range at line 54 column 17.
OriginalApplicationID=45913 December=1 January=1 February=1 March=1 April=1 May=1 June=1 July=1 August=1 September=2 October=1
Month=* i=10 S_Month=  _ERROR_=1 _N_=749
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 749 observations read from the data set WORK.NEMO_STG_LMTH.
WARNING: The data set WORK.NEMO_TEST may be incomplete.  When this step was stopped there were 748 observations and 15 variables.
WARNING: Data set WORK.NEMO_TEST was not replaced because this step was stopped.&lt;/PRE&gt;&lt;P&gt;Hi I have data something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when i try the array for last 11 months of data, i am getting array subscript error: can someone please help me in resolving the issue&lt;/P&gt;&lt;P&gt;business logic:&lt;/P&gt;&lt;P&gt;1) if October Month(11) is 1 and Month(1-10) is 2 then that Month name should be printed&lt;/P&gt;&lt;P&gt;2) if October Month(11) is 2 and Month(1-10) is 3 then where ever month starts with 3 then that month name should be printed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g., from the error message i want month to be September.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Nemo_stg.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34371i414D49FF38D75C11/image-size/large?v=v2&amp;amp;px=999" role="button" title="Nemo_stg.PNG" alt="Nemo_stg.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 13:08:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608691#M17736</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2019-12-02T13:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608696#M17738</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/301412"&gt;@vnreddy&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please share some sample data?&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 13:20:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608696#M17738</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-12-02T13:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608697#M17739</link>
      <description>&lt;P&gt;Why are you defining Month as character when you later want to use it as an index into an array?&lt;/P&gt;
&lt;P&gt;Why are you comparing your array elements with numbers, when they are defined as character?&lt;/P&gt;
&lt;P&gt;And why are you working so hard at making your code unreadable? Writing spaghetti garbage like this is guaranteed to cause problems.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please post the log of the&amp;nbsp;&lt;EM&gt;whole&lt;/EM&gt; step so we can locate exactly which lines SAS is complaining about, the contents of macro variable &amp;amp;dt_nm, and dataset nemo_stg_lmth in usable form (data step with datalines).&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 13:27:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608697#M17739</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-02T13:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608698#M17740</link>
      <description>&lt;P&gt;Also please post the code you actually ran, as your code as posted can NEVER work, see this what I got after I formatted this spaghetti ****:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data nemo_test;
set nemo_stg_lmth;
array mth(11) &amp;amp;dt_nm;
if mth(11) = 3
then Month = " ";
else if mth(11) = 2
then do;
  do i = 1 to 10;
    if mth(i) = 3 
    then do;
      Month = i;
      leave;
    end;
  end;
end;
else; /* null statement! */
if mth(11) = 1
then do;
  do i = 1 to 10;
    if mth(i) = 3
    then do;
    Month = i;
    leave;
  end;
end;
if Month = ""
then do;
  do i = 1 to 10;
    if mth(i) = 2
    then do;
      Month = i;
      leave;
    end;
  end;
end; end; /* this surplus end causes the step to fail at compilation! */
if Month NE "" then
S_Month = vname(mth(Month));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Dec 2019 13:33:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608698#M17740</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-02T13:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608707#M17745</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sorry about that, i am quite new to SAS and learning to put things together by gathering&lt;/P&gt;&lt;P&gt;some useful tips from SAS community&lt;/P&gt;&lt;P&gt;complete code so far i have used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and please see the sample data image:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let todaysDate = %sysfunc(today(), date9.);

data _null_;
/*last_month = intnx("Month", "&amp;amp;todaysDate."d, -1, "END");*/
/*call symputx ('last_month', put(last_month, date9.));*/
Month_back2 = intnx("Month", "&amp;amp;todaysDate."d, -2, "END");
call symputx ('Month_back2', put(Month_back2, date9.));
Month_back3 = intnx("Month", "&amp;amp;todaysDate."d, -3, "END");
call symputx ('Month_back3', put(Month_back3, date9.));
Month_back4 = intnx("Month", "&amp;amp;todaysDate."d, -4, "END");
Month_back12 = intnx("Month", "&amp;amp;todaysDate."d, -12, "END");
call symputx ('Month_back12', put(Month_back12, date9.));
run;


%put where date between "&amp;amp;Month_back12"d and "&amp;amp;last_month"d;
%put &amp;amp;todaysDate &amp;amp;last_month &amp;amp;Month_back2 &amp;amp;Month_back3 &amp;amp;Month_back4 &amp;amp;Month_back12;


data nemo.nemo_ecl_prod_t;
set nemo.nemo_ecl_prod;
run;

/*
proc contents data=nemo.nemo_ecl_prod_t;
run;
*/

data work.nemo_twelve_month (keep=OriginalApplicationID Stage ECL run_date nemo_date);
set nemo.nemo_ecl_prod_t;
where nemo_date between "&amp;amp;Month_back12."d and "&amp;amp;Month_back2"d /*"&amp;amp;last_month"d*/ /*and latest_run = 'Y'*/;
run;

PROC SQL;
CREATE TABLE WORK.nemo_month_fmt AS 
SELECT OriginalApplicationID, 
       Stage, 
       ECL, 
	   run_date max(run_date) as m_rundate,
       nemo_date,
	   nemo_date FORMAT=MONNAME9. AS Month
      FROM WORK.NEMO_TWELVE_MONTH;
QUIT;

data nemo_month_fmt_;
set nemo_month_fmt;
where OriginalApplicationID NE . ;
run;
/*
proc sort data=nemo_month_fmt_;
by originalapplicationid;
run;
*/

proc sql;
create table nemo_dup_month as
select *
from nemo_month_fmt
group by nemo_date
/*having nemo_date = max(nemo_date);*/
having m_rundate = max(m_rundate);
quit;

proc sort data=nemo_dup_month;
by originalapplicationid;
run;

proc transpose data=nemo_dup_month out=nemo_m_fmt(drop=_name_);
by originalapplicationid;
var stage;
id Month;
run;


options symbolgen mlogic mprint;
data nemo_test;
/*set nemo_stg_lmth;*/
set nemo_m_fmt;
array mth(11) December January February March April May June July August September October;
/*array mth(11) &amp;amp;dt_nm;*/
if mth(11) = 3 then
Month = " ";
else if mth(11) = 2 then
do;
do i = 1 to 10;
if mth(i) = 3 then
do;
Month = i; leave;
end; end; end;
else;
if mth(11) = 1 then
do;
do i = 1 to 10;
if mth(i) = 3 then
do;
Month = i; leave;
end; end;
if Month = "" then 
do;
do i = 1 to 10;
if mth(i) = 2 then
do;
Month = i; leave;
end; end; end; end;
if Month NE "" then
S_Month = vname(mth(Month));
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Nemo_stg.PNG" style="width: 492px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34373iDA02FB62DBC2191B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Nemo_stg.PNG" alt="Nemo_stg.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 14:27:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608707#M17745</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2019-12-02T14:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608717#M17748</link>
      <description>&lt;P&gt;OriginalApplicationID Stage ECL Nemo_date&lt;BR /&gt;7267 2 310.4922578 31-Dec-18&lt;BR /&gt;7267 2 284.1795028 31-Jan-19&lt;BR /&gt;7267 2 305.9252432 28-Feb-19&lt;BR /&gt;7267 2 647.556714 31-Mar-19&lt;BR /&gt;7267 3 932.4284102 30-Apr-19&lt;BR /&gt;7267 3 839.5357268 31-May-19&lt;BR /&gt;7267 3 806.460993 30-Jun-19&lt;BR /&gt;7267 3 739.9468882 31-Jul-19&lt;BR /&gt;7267 3 718.860982 31-Aug-19&lt;BR /&gt;7267 2 635.573145 30-Sep-19&lt;BR /&gt;7267 2 656.0290522 31-Oct-19&lt;BR /&gt;7793 1 35.58316204 31-Dec-18&lt;BR /&gt;7793 1 35.96957208 31-Jan-19&lt;BR /&gt;7793 1 55.3785582 28-Feb-19&lt;BR /&gt;7793 2 923.2837645 31-Mar-19&lt;BR /&gt;7793 2 919.0402749 30-Apr-19&lt;BR /&gt;7793 2 930.659084 31-May-19&lt;BR /&gt;7793 1 34.8811567 30-Jun-19&lt;BR /&gt;7793 1 34.65632422 31-Jul-19&lt;BR /&gt;7793 1 33.70968438 31-Aug-19&lt;BR /&gt;7793 1 33.07500636 30-Sep-19&lt;BR /&gt;7793 1 17.12617064 31-Oct-19&lt;BR /&gt;9434 1 7.189149224 31-Dec-18&lt;BR /&gt;9434 1 7.14900696 31-Jan-19&lt;BR /&gt;9434 1 7.022060722 28-Feb-19&lt;BR /&gt;9434 1 6.916268217 31-Mar-19&lt;BR /&gt;9434 1 6.792931518 30-Apr-19&lt;BR /&gt;9434 1 6.76085288 31-May-19&lt;BR /&gt;9434 1 6.681789709 30-Jun-19&lt;BR /&gt;9434 1 10.17436687 31-Jul-19&lt;BR /&gt;9434 2 891.1101093 31-Aug-19&lt;BR /&gt;9434 2 753.416957 30-Sep-19&lt;BR /&gt;9434 1 35.51067285 31-Oct-19&lt;BR /&gt;9523 1 20.49622488 31-Dec-18&lt;BR /&gt;9523 1 20.62410657 31-Jan-19&lt;BR /&gt;9523 1 20.31687893 28-Feb-19&lt;BR /&gt;9523 1 20.08796033 31-Mar-19&lt;BR /&gt;9523 1 19.77000246 30-Apr-19&lt;BR /&gt;9523 1 19.62216115 31-May-19&lt;BR /&gt;9523 1 19.48598417 30-Jun-19&lt;BR /&gt;9523 1 19.21695299 31-Jul-19&lt;BR /&gt;9523 1 18.77420846 31-Aug-19&lt;BR /&gt;9523 1 18.46826511 30-Sep-19&lt;BR /&gt;9523 1 18.18600003 31-Oct-19&lt;BR /&gt;9532 2 1622.924956 31-Dec-18&lt;BR /&gt;9532 2 1599.94398 31-Jan-19&lt;BR /&gt;9532 2 1550.340788 28-Feb-19&lt;BR /&gt;9532 2 1544.018303 31-Mar-19&lt;BR /&gt;9532 2 1574.572185 30-Apr-19&lt;BR /&gt;9532 2 1524.781151 31-May-19&lt;BR /&gt;9532 1 225.2265888 30-Jun-19&lt;BR /&gt;9532 1 225.396246 31-Jul-19&lt;BR /&gt;9532 1 194.0203314 31-Aug-19&lt;BR /&gt;9532 1 188.694135 30-Sep-19&lt;BR /&gt;9532 1 186.1166642 31-Oct-19&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 14:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608717#M17748</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2019-12-02T14:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608725#M17749</link>
      <description>&lt;P&gt;There is no variable run_date in your data.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 15:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608725#M17749</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-02T15:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608734#M17750</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sorry i have excluded run_date from that piece of data, i have multiple run_dates.&lt;/P&gt;&lt;P&gt;anyway we don't that column in output report, i have taken that column just extract latest run data.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 15:23:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608734#M17750</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2019-12-02T15:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608735#M17751</link>
      <description>&lt;P&gt;Your code uses run_date, so we need that in the example dataset.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 15:24:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608735#M17751</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-02T15:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608738#M17752</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OriginalApplicationID Stage ECL Nemo_date run_date&lt;BR /&gt;7267 2 310.4922578 31-Dec-18 03JAN19:06:10:18&lt;BR /&gt;7267 2 284.1795028 31-Jan-19 04FEB19:06:04:44&lt;BR /&gt;7267 2 305.9252432 28-Feb-19 04MAR19:10:55:37&lt;BR /&gt;7267 2 647.556714 31-Mar-19 02APR19:09:55:12&lt;BR /&gt;7267 3 932.4284102 30-Apr-19 02MAY19:06:46:31&lt;BR /&gt;7267 3 839.5357268 31-May-19 04JUN19:06:05:27&lt;BR /&gt;7267 3 806.460993 30-Jun-19 02JUL19:06:05:38&lt;BR /&gt;7267 3 739.9468882 31-Jul-19 02AUG19:16:50:19&lt;BR /&gt;7267 3 718.860982 31-Aug-19 03SEP19:06:03:59&lt;BR /&gt;7267 2 635.573145 30-Sep-19 02OCT19:06:04:18&lt;BR /&gt;7267 2 656.0290522 31-Oct-19 04NOV19:06:04:17&lt;BR /&gt;7793 1 35.58316204 31-Dec-18 03JAN19:06:10:18&lt;BR /&gt;7793 1 35.96957208 31-Jan-19 04FEB19:06:04:44&lt;BR /&gt;7793 1 55.3785582 28-Feb-19 04MAR19:10:55:37&lt;BR /&gt;7793 2 923.2837645 31-Mar-19 02APR19:09:55:12&lt;BR /&gt;7793 2 919.0402749 30-Apr-19 02MAY19:06:46:31&lt;BR /&gt;7793 2 930.659084 31-May-19 04JUN19:06:05:27&lt;BR /&gt;7793 1 34.8811567 30-Jun-19 02JUL19:06:05:38&lt;BR /&gt;7793 1 34.65632422 31-Jul-19 02AUG19:16:50:19&lt;BR /&gt;7793 1 33.70968438 31-Aug-19 03SEP19:06:03:59&lt;BR /&gt;7793 1 33.07500636 30-Sep-19 02OCT19:06:04:18&lt;BR /&gt;7793 1 17.12617064 31-Oct-19 04NOV19:06:04:17&lt;BR /&gt;9434 1 7.189149224 31-Dec-18 03JAN19:06:10:18&lt;BR /&gt;9434 1 7.14900696 31-Jan-19 04FEB19:06:04:44&lt;BR /&gt;9434 1 7.022060722 28-Feb-19 04MAR19:10:55:37&lt;BR /&gt;9434 1 6.916268217 31-Mar-19 02APR19:09:55:12&lt;BR /&gt;9434 1 6.792931518 30-Apr-19 02MAY19:06:46:31&lt;BR /&gt;9434 1 6.76085288 31-May-19 04JUN19:06:05:27&lt;BR /&gt;9434 1 6.681789709 30-Jun-19 02JUL19:06:05:38&lt;BR /&gt;9434 1 10.17436687 31-Jul-19 02AUG19:16:50:19&lt;BR /&gt;9434 2 891.1101093 31-Aug-19 03SEP19:06:03:59&lt;BR /&gt;9434 2 753.416957 30-Sep-19 02OCT19:06:04:18&lt;BR /&gt;9434 1 35.51067285 31-Oct-19 04NOV19:06:04:17&lt;BR /&gt;9523 1 20.49622488 31-Dec-18 03JAN19:06:10:18&lt;BR /&gt;9523 1 20.62410657 31-Jan-19 04FEB19:06:04:44&lt;BR /&gt;9523 1 20.31687893 28-Feb-19 04MAR19:10:55:37&lt;BR /&gt;9523 1 20.08796033 31-Mar-19 02APR19:09:55:12&lt;BR /&gt;9523 1 19.77000246 30-Apr-19 02MAY19:06:46:31&lt;BR /&gt;9523 1 19.62216115 31-May-19 04JUN19:06:05:27&lt;BR /&gt;9523 1 19.48598417 30-Jun-19 02JUL19:06:05:38&lt;BR /&gt;9523 1 19.21695299 31-Jul-19 02AUG19:16:50:19&lt;BR /&gt;9523 1 18.77420846 31-Aug-19 03SEP19:06:03:59&lt;BR /&gt;9523 1 18.46826511 30-Sep-19 02OCT19:06:04:18&lt;BR /&gt;9523 1 18.18600003 31-Oct-19 04NOV19:06:04:17&lt;BR /&gt;9532 2 1622.924956 31-Dec-18 03JAN19:06:10:18&lt;BR /&gt;9532 2 1599.94398 31-Jan-19 04FEB19:06:04:44&lt;BR /&gt;9532 2 1550.340788 28-Feb-19 04MAR19:10:55:37&lt;BR /&gt;9532 2 1544.018303 31-Mar-19 02APR19:09:55:12&lt;BR /&gt;9532 2 1574.572185 30-Apr-19 02MAY19:06:46:31&lt;BR /&gt;9532 2 1524.781151 31-May-19 04JUN19:06:05:27&lt;BR /&gt;9532 1 225.2265888 30-Jun-19 02JUL19:06:05:38&lt;BR /&gt;9532 1 225.396246 31-Jul-19 02AUG19:16:50:19&lt;BR /&gt;9532 1 194.0203314 31-Aug-19 03SEP19:06:03:59&lt;BR /&gt;9532 1 188.694135 30-Sep-19 02OCT19:06:04:18&lt;BR /&gt;9532 1 186.1166642 31-Oct-19 04NOV19:06:04:17&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 15:41:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608738#M17752</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2019-12-02T15:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608774#M17758</link>
      <description>&lt;P&gt;This code runs without ERRORS, WARNINGS or any extraneous NOTEs:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data nemo_ecl_prod;
input OriginalApplicationID Stage ECL Nemo_date :date9. run_date :date9.;
format Nemo_date run_date yymmddd10.;
datalines;
7267 2 310.4922578 31-Dec-18 03JAN19:06:10:18
7267 2 284.1795028 31-Jan-19 04FEB19:06:04:44
7267 2 305.9252432 28-Feb-19 04MAR19:10:55:37
7267 2 647.556714 31-Mar-19 02APR19:09:55:12
7267 3 932.4284102 30-Apr-19 02MAY19:06:46:31
7267 3 839.5357268 31-May-19 04JUN19:06:05:27
7267 3 806.460993 30-Jun-19 02JUL19:06:05:38
7267 3 739.9468882 31-Jul-19 02AUG19:16:50:19
7267 3 718.860982 31-Aug-19 03SEP19:06:03:59
7267 2 635.573145 30-Sep-19 02OCT19:06:04:18
7267 2 656.0290522 31-Oct-19 04NOV19:06:04:17
7793 1 35.58316204 31-Dec-18 03JAN19:06:10:18
7793 1 35.96957208 31-Jan-19 04FEB19:06:04:44
7793 1 55.3785582 28-Feb-19 04MAR19:10:55:37
7793 2 923.2837645 31-Mar-19 02APR19:09:55:12
7793 2 919.0402749 30-Apr-19 02MAY19:06:46:31
7793 2 930.659084 31-May-19 04JUN19:06:05:27
7793 1 34.8811567 30-Jun-19 02JUL19:06:05:38
7793 1 34.65632422 31-Jul-19 02AUG19:16:50:19
7793 1 33.70968438 31-Aug-19 03SEP19:06:03:59
7793 1 33.07500636 30-Sep-19 02OCT19:06:04:18
7793 1 17.12617064 31-Oct-19 04NOV19:06:04:17
9434 1 7.189149224 31-Dec-18 03JAN19:06:10:18
9434 1 7.14900696 31-Jan-19 04FEB19:06:04:44
9434 1 7.022060722 28-Feb-19 04MAR19:10:55:37
9434 1 6.916268217 31-Mar-19 02APR19:09:55:12
9434 1 6.792931518 30-Apr-19 02MAY19:06:46:31
9434 1 6.76085288 31-May-19 04JUN19:06:05:27
9434 1 6.681789709 30-Jun-19 02JUL19:06:05:38
9434 1 10.17436687 31-Jul-19 02AUG19:16:50:19
9434 2 891.1101093 31-Aug-19 03SEP19:06:03:59
9434 2 753.416957 30-Sep-19 02OCT19:06:04:18
9434 1 35.51067285 31-Oct-19 04NOV19:06:04:17
9523 1 20.49622488 31-Dec-18 03JAN19:06:10:18
9523 1 20.62410657 31-Jan-19 04FEB19:06:04:44
9523 1 20.31687893 28-Feb-19 04MAR19:10:55:37
9523 1 20.08796033 31-Mar-19 02APR19:09:55:12
9523 1 19.77000246 30-Apr-19 02MAY19:06:46:31
9523 1 19.62216115 31-May-19 04JUN19:06:05:27
9523 1 19.48598417 30-Jun-19 02JUL19:06:05:38
9523 1 19.21695299 31-Jul-19 02AUG19:16:50:19
9523 1 18.77420846 31-Aug-19 03SEP19:06:03:59
9523 1 18.46826511 30-Sep-19 02OCT19:06:04:18
9523 1 18.18600003 31-Oct-19 04NOV19:06:04:17
9532 2 1622.924956 31-Dec-18 03JAN19:06:10:18
9532 2 1599.94398 31-Jan-19 04FEB19:06:04:44
9532 2 1550.340788 28-Feb-19 04MAR19:10:55:37
9532 2 1544.018303 31-Mar-19 02APR19:09:55:12
9532 2 1574.572185 30-Apr-19 02MAY19:06:46:31
9532 2 1524.781151 31-May-19 04JUN19:06:05:27
9532 1 225.2265888 30-Jun-19 02JUL19:06:05:38
9532 1 225.396246 31-Jul-19 02AUG19:16:50:19
9532 1 194.0203314 31-Aug-19 03SEP19:06:03:59
9532 1 188.694135 30-Sep-19 02OCT19:06:04:18
9532 1 186.1166642 31-Oct-19 04NOV19:06:04:17
;

%let todaysDate = %sysfunc(today(), date9.);

data _null_;
last_month = intnx("Month", "&amp;amp;todaysDate."d, -1, "END");
call symputx ('last_month', put(last_month, date9.));
Month_back2 = intnx("Month", "&amp;amp;todaysDate."d, -2, "END");
call symputx ('Month_back2', put(Month_back2, date9.));
Month_back3 = intnx("Month", "&amp;amp;todaysDate."d, -3, "END");
call symputx ('Month_back3', put(Month_back3, date9.));
Month_back4 = intnx("Month", "&amp;amp;todaysDate."d, -4, "END");
Month_back12 = intnx("Month", "&amp;amp;todaysDate."d, -12, "END");
call symputx ('Month_back12', put(Month_back12, date9.));
run;


%put where date between "&amp;amp;Month_back12"d and "&amp;amp;last_month"d;
%put &amp;amp;todaysDate &amp;amp;last_month &amp;amp;Month_back2 &amp;amp;Month_back3 &amp;amp;Month_back12;


data nemo_ecl_prod_t;
set nemo_ecl_prod;
run;

/*
proc contents data=nemo.nemo_ecl_prod_t;
run;
*/

data nemo_twelve_month (keep=OriginalApplicationID Stage ECL run_date nemo_date);
set nemo_ecl_prod_t;
where nemo_date between "&amp;amp;Month_back12."d and "&amp;amp;Month_back2"d /*"&amp;amp;last_month"d*/ /*and latest_run = 'Y'*/;
run;

PROC SQL;
CREATE TABLE nemo_month_fmt AS 
SELECT OriginalApplicationID, 
       Stage, 
       ECL, 
	   run_date max(run_date) as m_rundate,
       nemo_date,
	   nemo_date FORMAT=MONNAME9. AS Month
      FROM NEMO_TWELVE_MONTH;
QUIT;

data nemo_month_fmt_;
set nemo_month_fmt;
where OriginalApplicationID NE . ;
run;
/*
proc sort data=nemo_month_fmt_;
by originalapplicationid;
run;
*/

proc sql;
create table nemo_dup_month as
select *
from nemo_month_fmt
group by nemo_date
/*having nemo_date = max(nemo_date);*/
having m_rundate = max(m_rundate);
quit;

proc sort data=nemo_dup_month;
by originalapplicationid;
run;

proc transpose data=nemo_dup_month out=nemo_m_fmt(drop=_name_);
by originalapplicationid;
var stage;
id Month;
run;


options symbolgen mlogic mprint;
data nemo_test;
/*set nemo_stg_lmth;*/
set nemo_m_fmt;
array mth(11) December January February March April May June July August September October;
/*array mth(11) &amp;amp;dt_nm;*/
if mth(11) = 3 then
Month = " ";
else if mth(11) = 2 then
do;
  do i = 1 to 10;
    if mth(i) = 3 then
    do;
      Month = i;
      leave;
    end;
  end;
end;
else;
if mth(11) = 1 then
do;
  do i = 1 to 10;
    if mth(i) = 3 then
    do;
      Month = i;
      leave;
    end;
  end;
  if Month = "" then 
  do;
    do i = 1 to 10;
      if mth(i) = 2 then
      do;
        Month = i;
        leave;
      end;
    end;
  end;
end;
if Month NE "" then
S_Month = vname(mth(Month));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Dec 2019 16:50:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608774#M17758</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-02T16:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608779#M17760</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;program is running fine without any errors, unfortunately, it's not fulfilling my requirement.&lt;/P&gt;&lt;P&gt;S_Month should be something like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OriginalApplicationID&amp;nbsp; &amp;nbsp; &amp;nbsp;S_Month&lt;/P&gt;&lt;P&gt;7267&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;April&lt;BR /&gt;7793&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;March&lt;BR /&gt;9434&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;August&lt;BR /&gt;9523&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;BR /&gt;9532&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;December&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 17:06:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608779#M17760</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2019-12-02T17:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608792#M17761</link>
      <description>&lt;P&gt;What is the logical rule for selecting the month?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 17:22:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608792#M17761</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-02T17:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608793#M17762</link>
      <description>business logic:&lt;BR /&gt;&lt;BR /&gt;1) if October Month(11) is 1 and Month(1-10) is 2 then that Month name should be printed&lt;BR /&gt;&lt;BR /&gt;2) if October Month(11) is 2 and Month(1-10) is 3 then where ever month starts with 3 then that month name should be printed</description>
      <pubDate>Mon, 02 Dec 2019 17:25:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608793#M17762</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2019-12-02T17:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608804#M17766</link>
      <description>&lt;P&gt;Then that whole befuddling operation is unnecessary, one single data step does it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data nemo_ecl_prod;
input OriginalApplicationID Stage ECL Nemo_date :date9. run_date :date9.;
format Nemo_date run_date yymmddd10.;
datalines;
7267 2 310.4922578 31-Dec-18 03JAN19:06:10:18
7267 2 284.1795028 31-Jan-19 04FEB19:06:04:44
7267 2 305.9252432 28-Feb-19 04MAR19:10:55:37
7267 2 647.556714 31-Mar-19 02APR19:09:55:12
7267 3 932.4284102 30-Apr-19 02MAY19:06:46:31
7267 3 839.5357268 31-May-19 04JUN19:06:05:27
7267 3 806.460993 30-Jun-19 02JUL19:06:05:38
7267 3 739.9468882 31-Jul-19 02AUG19:16:50:19
7267 3 718.860982 31-Aug-19 03SEP19:06:03:59
7267 2 635.573145 30-Sep-19 02OCT19:06:04:18
7267 2 656.0290522 31-Oct-19 04NOV19:06:04:17
7793 1 35.58316204 31-Dec-18 03JAN19:06:10:18
7793 1 35.96957208 31-Jan-19 04FEB19:06:04:44
7793 1 55.3785582 28-Feb-19 04MAR19:10:55:37
7793 2 923.2837645 31-Mar-19 02APR19:09:55:12
7793 2 919.0402749 30-Apr-19 02MAY19:06:46:31
7793 2 930.659084 31-May-19 04JUN19:06:05:27
7793 1 34.8811567 30-Jun-19 02JUL19:06:05:38
7793 1 34.65632422 31-Jul-19 02AUG19:16:50:19
7793 1 33.70968438 31-Aug-19 03SEP19:06:03:59
7793 1 33.07500636 30-Sep-19 02OCT19:06:04:18
7793 1 17.12617064 31-Oct-19 04NOV19:06:04:17
9434 1 7.189149224 31-Dec-18 03JAN19:06:10:18
9434 1 7.14900696 31-Jan-19 04FEB19:06:04:44
9434 1 7.022060722 28-Feb-19 04MAR19:10:55:37
9434 1 6.916268217 31-Mar-19 02APR19:09:55:12
9434 1 6.792931518 30-Apr-19 02MAY19:06:46:31
9434 1 6.76085288 31-May-19 04JUN19:06:05:27
9434 1 6.681789709 30-Jun-19 02JUL19:06:05:38
9434 1 10.17436687 31-Jul-19 02AUG19:16:50:19
9434 2 891.1101093 31-Aug-19 03SEP19:06:03:59
9434 2 753.416957 30-Sep-19 02OCT19:06:04:18
9434 1 35.51067285 31-Oct-19 04NOV19:06:04:17
9523 1 20.49622488 31-Dec-18 03JAN19:06:10:18
9523 1 20.62410657 31-Jan-19 04FEB19:06:04:44
9523 1 20.31687893 28-Feb-19 04MAR19:10:55:37
9523 1 20.08796033 31-Mar-19 02APR19:09:55:12
9523 1 19.77000246 30-Apr-19 02MAY19:06:46:31
9523 1 19.62216115 31-May-19 04JUN19:06:05:27
9523 1 19.48598417 30-Jun-19 02JUL19:06:05:38
9523 1 19.21695299 31-Jul-19 02AUG19:16:50:19
9523 1 18.77420846 31-Aug-19 03SEP19:06:03:59
9523 1 18.46826511 30-Sep-19 02OCT19:06:04:18
9523 1 18.18600003 31-Oct-19 04NOV19:06:04:17
9532 2 1622.924956 31-Dec-18 03JAN19:06:10:18
9532 2 1599.94398 31-Jan-19 04FEB19:06:04:44
9532 2 1550.340788 28-Feb-19 04MAR19:10:55:37
9532 2 1544.018303 31-Mar-19 02APR19:09:55:12
9532 2 1574.572185 30-Apr-19 02MAY19:06:46:31
9532 2 1524.781151 31-May-19 04JUN19:06:05:27
9532 1 225.2265888 30-Jun-19 02JUL19:06:05:38
9532 1 225.396246 31-Jul-19 02AUG19:16:50:19
9532 1 194.0203314 31-Aug-19 03SEP19:06:03:59
9532 1 188.694135 30-Sep-19 02OCT19:06:04:18
9532 1 186.1166642 31-Oct-19 04NOV19:06:04:17
;

data want;
set nemo_ecl_prod;
by OriginalApplicationID;
retain
  month2
  month3
;
if first.OriginalApplicationID
then do;
  month2 = .;
  month3 = .;
  month = .;
end;
if not last.OriginalApplicationID
then do;
  if month2 = . and stage = 2 then month2 = month(nemo_date);
  if month3 = . and stage = 3 then month3 = month(nemo_date);
end;
if last.OriginalApplicationID;
if stage = 1 and month2 ne . then month = put(mdy(month2,1,2019),monname.);
if stage = 2 and month3 ne . then month = put(mdy(month3,1,2019),monname.);
keep OriginalApplicationID month;
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;OriginalApplicationID	month
7267	April
7793	March
9434	August
9523	 
9532	December&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 18:09:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/608804#M17766</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-02T18:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/609009#M17789</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the program given by you..i am not getting any results in Month column. I am getting blank rows&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
22         
23         GOPTIONS ACCESSIBLE;
24         
25         data want;
26         set nemo_ecl_prod;
27         by OriginalApplicationID;
28         retain
29           month2
30           month3
31         ;
32         if first.OriginalApplicationID
33         then do;
34           month2 = .;
35           month3 = .;
36           month = .;
37         end;
38         if not last.OriginalApplicationID
39         then do;
40           if month2 = . and stage = 2 then month2 = month(nemo_date);
41           if month3 = . and stage = 3 then month3 = month(nemo_date);
42         end;
43         if last.OriginalApplicationID;
44         if stage = 1 and month2 ne . then month = put(mdy(month2,1,2019),monname.);
45         if stage = 2 and month3 ne . then month = put(mdy(month3,1,2019),monname.);
46         keep OriginalApplicationID month;
47         run;

NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
      44:43   45:43   
NOTE: Invalid numeric data, '    April' , at line 45 column 43.
OriginalApplicationID=7267 Stage=2 ECL=656.0290522 Nemo_date=2019-10-31 run_date=2019-11-04 FIRST.OriginalApplicationID=0
LAST.OriginalApplicationID=1 month2=12 month3=4 month=. _ERROR_=1 _N_=11
NOTE: Invalid numeric data, '    March' , at line 44 column 43.
OriginalApplicationID=7793 Stage=1 ECL=17.12617064 Nemo_date=2019-10-31 run_date=2019-11-04 FIRST.OriginalApplicationID=0
LAST.OriginalApplicationID=1 month2=3 month3=. month=. _ERROR_=1 _N_=22
2                                                          The SAS System                            10:25 Tuesday, December 3, 2019

NOTE: Invalid numeric data, '   August' , at line 44 column 43.
OriginalApplicationID=9434 Stage=1 ECL=35.51067285 Nemo_date=2019-10-31 run_date=2019-11-04 FIRST.OriginalApplicationID=0
LAST.OriginalApplicationID=1 month2=8 month3=. month=. _ERROR_=1 _N_=33
NOTE: Invalid numeric data, ' December' , at line 44 column 43.
OriginalApplicationID=9532 Stage=1 ECL=186.1166642 Nemo_date=2019-10-31 run_date=2019-11-04 FIRST.OriginalApplicationID=0
LAST.OriginalApplicationID=1 month2=12 month3=. month=. _ERROR_=1 _N_=55
NOTE: There were 55 observations read from the data set WORK.NEMO_ECL_PROD.
NOTE: The data set WORK.WANT has 5 observations and 2 variables.&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Dec 2019 11:18:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/609009#M17789</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2019-12-03T11:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/609015#M17791</link>
      <description>&lt;P&gt;Remove the line&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  month = .;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;from the code (line 36 in your log). That's an artifact from testing it with purely numeric values.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 11:38:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/609015#M17791</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-03T11:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/609022#M17792</link>
      <description>Thank you so much</description>
      <pubDate>Tue, 03 Dec 2019 11:48:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/609022#M17792</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2019-12-03T11:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/609096#M17816</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;program what you gave yesterday worked fine with the data what i have yesterday, unfortunately, it's not working&lt;/P&gt;&lt;P&gt;with another piece of data with different stages.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Input&lt;/P&gt;&lt;P&gt;OriginalApplicationID November December January February March April May June July August September October&lt;BR /&gt;113 2 2 2 2 2 1 1 1 1 1 1 1&lt;BR /&gt;767 2 2 2 2 2 2 1 1 1 2 1 1&lt;BR /&gt;1606 2 2 2 1 1 1 1 1 1 1 1 1&lt;BR /&gt;4745 1 1 1 1 1 1 2 1 1 1 1 1&lt;BR /&gt;4750 2 2 2 2 2 2 2 2 2 2 1 1&lt;BR /&gt;4769 3 3 3 3 3 3 3 3 3 3 3 2&lt;BR /&gt;4964 2 2 2 2 2 2 2 1 1 1 2 1&lt;BR /&gt;5585 1 1 1 2 2 1 1 1 1 1 1 1&lt;BR /&gt;5601 2 2 2 2 2 2 2 1 1 1 1 1&lt;BR /&gt;5608 1 1 2 2 2 1 1 1 1 1 1 1&lt;BR /&gt;6993 1 1 2 2 2 1 1 1 1 1 1 1&lt;BR /&gt;7267 2 2 2 2 2 3 3 3 3 3 2 2&lt;BR /&gt;7793 1 1 1 1 2 2 2 1 1 1 1 1&lt;BR /&gt;8160 3 2 2 2 2 2 2 2 2 2 2 2&lt;BR /&gt;8691 1 1 1 1 2 2 2 2 2 1 1 1&lt;BR /&gt;8758 1 1 1 1 1 2 2 2 1 1 1 1&lt;BR /&gt;253 2 2 2 2 2 2 2 2 2 2 2 2&lt;BR /&gt;254 2 2 2 2 2 2 2 2 2 2 2 2&lt;BR /&gt;424 2 2 2 2 2 2 2 2 2 2 2 2&lt;BR /&gt;467 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;509 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;585 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;618 3 3 3 3 3 3 3 3 3 3 3 3&lt;BR /&gt;646 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;654 1 1 1 1 1 1 1 1 1 1 1 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected output&lt;BR /&gt;OriginalApplicationID November December January February March April May June July August September October Default&lt;BR /&gt;113 2 2 2 2 2 1 1 1 1 1 1 1 November&lt;BR /&gt;767 2 2 2 2 2 2 1 1 1 2 1 1 November&lt;BR /&gt;1606 2 2 2 1 1 1 1 1 1 1 1 1 November&lt;BR /&gt;4745 1 1 1 1 1 1 2 1 1 1 1 1 May&lt;BR /&gt;4750 2 2 2 2 2 2 2 2 2 2 1 1 November&lt;BR /&gt;4769 3 3 3 3 3 3 3 3 3 3 3 2 November&lt;BR /&gt;4964 2 2 2 2 2 2 2 1 1 1 2 1 November&lt;BR /&gt;5585 1 1 1 2 2 1 1 1 1 1 1 1 February&lt;BR /&gt;5601 2 2 2 2 2 2 2 1 1 1 1 1 November&lt;BR /&gt;5608 1 1 2 2 2 1 1 1 1 1 1 1 January&lt;BR /&gt;6993 1 1 2 2 2 1 1 1 1 1 1 1 January&lt;BR /&gt;7267 2 2 2 2 2 3 3 3 3 3 2 2 April&lt;BR /&gt;7793 1 1 1 1 2 2 2 1 1 1 1 1 March&lt;BR /&gt;8160 3 2 2 2 2 2 2 2 2 2 2 2 November&lt;BR /&gt;8691 1 1 1 1 2 2 2 2 2 1 1 1 March&lt;BR /&gt;8758 1 1 1 1 1 2 2 2 1 1 1 1 April&lt;BR /&gt;253 2 2 2 2 2 2 2 2 2 2 2 2&lt;BR /&gt;254 2 2 2 2 2 2 2 2 2 2 2 2&lt;BR /&gt;424 2 2 2 2 2 2 2 2 2 2 2 2&lt;BR /&gt;467 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;509 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;585 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;618 3 3 3 3 3 3 3 3 3 3 3 3&lt;BR /&gt;646 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;654 1 1 1 1 1 1 1 1 1 1 1 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 15:48:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/609096#M17816</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2019-12-03T15:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/609569#M17904</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/301412"&gt;@vnreddy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;program what you gave yesterday worked fine with the data what i have yesterday, unfortunately, it's not working&lt;/P&gt;
&lt;P&gt;with another piece of data with different stages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Input&lt;/P&gt;
&lt;P&gt;OriginalApplicationID November December January February March April May June July August September October&lt;BR /&gt;113 2 2 2 2 2 1 1 1 1 1 1 1&lt;BR /&gt;767 2 2 2 2 2 2 1 1 1 2 1 1&lt;BR /&gt;1606 2 2 2 1 1 1 1 1 1 1 1 1&lt;BR /&gt;4745 1 1 1 1 1 1 2 1 1 1 1 1&lt;BR /&gt;4750 2 2 2 2 2 2 2 2 2 2 1 1&lt;BR /&gt;4769 3 3 3 3 3 3 3 3 3 3 3 2&lt;BR /&gt;4964 2 2 2 2 2 2 2 1 1 1 2 1&lt;BR /&gt;5585 1 1 1 2 2 1 1 1 1 1 1 1&lt;BR /&gt;5601 2 2 2 2 2 2 2 1 1 1 1 1&lt;BR /&gt;5608 1 1 2 2 2 1 1 1 1 1 1 1&lt;BR /&gt;6993 1 1 2 2 2 1 1 1 1 1 1 1&lt;BR /&gt;7267 2 2 2 2 2 3 3 3 3 3 2 2&lt;BR /&gt;7793 1 1 1 1 2 2 2 1 1 1 1 1&lt;BR /&gt;8160 3 2 2 2 2 2 2 2 2 2 2 2&lt;BR /&gt;8691 1 1 1 1 2 2 2 2 2 1 1 1&lt;BR /&gt;8758 1 1 1 1 1 2 2 2 1 1 1 1&lt;BR /&gt;253 2 2 2 2 2 2 2 2 2 2 2 2&lt;BR /&gt;254 2 2 2 2 2 2 2 2 2 2 2 2&lt;BR /&gt;424 2 2 2 2 2 2 2 2 2 2 2 2&lt;BR /&gt;467 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;509 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;585 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;618 3 3 3 3 3 3 3 3 3 3 3 3&lt;BR /&gt;646 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;654 1 1 1 1 1 1 1 1 1 1 1 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Expected output&lt;BR /&gt;OriginalApplicationID November December January February March April May June July August September October Default&lt;BR /&gt;113 2 2 2 2 2 1 1 1 1 1 1 1 November&lt;BR /&gt;767 2 2 2 2 2 2 1 1 1 2 1 1 November&lt;BR /&gt;1606 2 2 2 1 1 1 1 1 1 1 1 1 November&lt;BR /&gt;4745 1 1 1 1 1 1 2 1 1 1 1 1 May&lt;BR /&gt;4750 2 2 2 2 2 2 2 2 2 2 1 1 November&lt;BR /&gt;4769 3 3 3 3 3 3 3 3 3 3 3 2 November&lt;BR /&gt;4964 2 2 2 2 2 2 2 1 1 1 2 1 November&lt;BR /&gt;5585 1 1 1 2 2 1 1 1 1 1 1 1 February&lt;BR /&gt;5601 2 2 2 2 2 2 2 1 1 1 1 1 November&lt;BR /&gt;5608 1 1 2 2 2 1 1 1 1 1 1 1 January&lt;BR /&gt;6993 1 1 2 2 2 1 1 1 1 1 1 1 January&lt;BR /&gt;7267 2 2 2 2 2 3 3 3 3 3 2 2 April&lt;BR /&gt;7793 1 1 1 1 2 2 2 1 1 1 1 1 March&lt;BR /&gt;8160 3 2 2 2 2 2 2 2 2 2 2 2 November&lt;BR /&gt;8691 1 1 1 1 2 2 2 2 2 1 1 1 March&lt;BR /&gt;8758 1 1 1 1 1 2 2 2 1 1 1 1 April&lt;BR /&gt;253 2 2 2 2 2 2 2 2 2 2 2 2&lt;BR /&gt;254 2 2 2 2 2 2 2 2 2 2 2 2&lt;BR /&gt;424 2 2 2 2 2 2 2 2 2 2 2 2&lt;BR /&gt;467 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;509 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;585 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;618 3 3 3 3 3 3 3 3 3 3 3 3&lt;BR /&gt;646 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;654 1 1 1 1 1 1 1 1 1 1 1 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please note that the code that &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;used starts with a data set using:&lt;/P&gt;
&lt;PRE&gt;input OriginalApplicationID Stage ECL Nemo_date :date9. run_date :date9.;
&lt;/PRE&gt;
&lt;P&gt;Your above data example apparently has variables:&lt;/P&gt;
&lt;PRE&gt;OriginalApplicationID November December January February March April May June July August September October&lt;/PRE&gt;
&lt;P&gt;Since the number and types of variables have almost no match I would be very surprised if the code ran on other types of data.&lt;/P&gt;
&lt;P&gt;Please note that Kurt's data has 2 date varaibles and your last example has no date variables. You would have to transform your data to look like the other data set to have a chance of getting the code to run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are referring to this part of Kurt's code:&lt;/P&gt;
&lt;PRE&gt;data nemo_test;
/*set nemo_stg_lmth;*/
set nemo_m_fmt;
array mth(11) December January February March April May June July August September October;
/*array mth(11) &amp;amp;dt_nm;*/
if mth(11) = 3 then
Month = " ";
else if mth(11) = 2 then
do;
  do i = 1 to 10;
    if mth(i) = 3 then
    do;
      Month = i;
      leave;
    end;
  end;
end;
else;
if mth(11) = 1 then
do;
  do i = 1 to 10;
    if mth(i) = 3 then
    do;
      Month = i;
      leave;
    end;
  end;
  if Month = "" then 
  do;
    do i = 1 to 10;
      if mth(i) = 2 then
      do;
        Month = i;
        leave;
      end;
    end;
  end;
end;
if Month NE "" then
S_Month = vname(mth(Month));
run;&lt;/PRE&gt;
&lt;P&gt;Then you need to note that your are including MORE variables (November), the order would change since where December was first position it is now second.&lt;/P&gt;
&lt;P&gt;So please show the actual code that you attempted against the new "data" that includes all of the adjustments you needed to make to address the additional variable and the changed positions of the like named data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 23:40:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays/m-p/609569#M17904</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-12-04T23:40:00Z</dc:date>
    </item>
  </channel>
</rss>

