<?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: Find first month in which flag occurs, across columns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Find-first-month-in-which-flag-occurs-across-columns/m-p/142901#M296883</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;proc import datafile='c:\temp\monte carlo example.xls' out=have dbms=excel replace;run;
data want(drop=i);
 set have;
 array x{*} month:;
 want=0;
 do i=1 to dim(x);
&amp;nbsp; if x{i} then do;want=i;leave;end;
 end;
run;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 16 Jun 2014 03:46:54 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2014-06-16T03:46:54Z</dc:date>
    <item>
      <title>Find first month in which flag occurs, across columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-first-month-in-which-flag-occurs-across-columns/m-p/142899#M296881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone. I have a dataset that has thousands of loans (down the rows) by months (across columns). It is basically a giant matrix of yes /no values (1,0 in format).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know a way to find the FIRST column (month) in which a yes flag occurs?&amp;nbsp; Please see the following excel file example with the final column named "desired answer" for an example of the input and output that I am looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If there is a way to do this without transposing the data it would be greatly appreciated, since the data is extremely large.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if anyone has any questions on this request!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jun 2014 03:29:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-first-month-in-which-flag-occurs-across-columns/m-p/142899#M296881</guid>
      <dc:creator>Anotherdream</dc:creator>
      <dc:date>2014-06-16T03:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: Find first month in which flag occurs, across columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-first-month-in-which-flag-occurs-across-columns/m-p/142900#M296882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your example has the first as 0/1/2 rather than 0/1, is that the actual case as your original question states 0/1?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it's only 0/1 look at the whichn function across the months.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003122573.htm" title="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003122573.htm"&gt;SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jun 2014 03:46:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-first-month-in-which-flag-occurs-across-columns/m-p/142900#M296882</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-06-16T03:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: Find first month in which flag occurs, across columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-first-month-in-which-flag-occurs-across-columns/m-p/142901#M296883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;proc import datafile='c:\temp\monte carlo example.xls' out=have dbms=excel replace;run;
data want(drop=i);
 set have;
 array x{*} month:;
 want=0;
 do i=1 to dim(x);
&amp;nbsp; if x{i} then do;want=i;leave;end;
 end;
run;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jun 2014 03:46:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-first-month-in-which-flag-occurs-across-columns/m-p/142901#M296883</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-06-16T03:46:54Z</dc:date>
    </item>
  </channel>
</rss>

