<?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: Read different value in excel and return value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Read-different-value-in-excel-and-return-value/m-p/402205#M278811</link>
    <description>Thank you so much for you comment:&lt;BR /&gt;&lt;BR /&gt;for costumer 1, in the two raw there is a value bigger than &amp;gt;30. Then select the min number of cells which is in the first row, that have A4 only. that is why its 1 .&lt;BR /&gt;&lt;BR /&gt;for customer 2 : there is only one value &amp;gt;30 . and only one value which is A4.&lt;BR /&gt;&lt;BR /&gt;for customer 3 : there is one value &amp;gt; 30. and there is three values before it which are A2, A3 and A4.&lt;BR /&gt;</description>
    <pubDate>Sun, 08 Oct 2017 18:26:17 GMT</pubDate>
    <dc:creator>ihlayyel</dc:creator>
    <dc:date>2017-10-08T18:26:17Z</dc:date>
    <item>
      <title>Read different value in excel and return value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-different-value-in-excel-and-return-value/m-p/402200#M278809</link>
      <description>&lt;P&gt;just would like to compare cell entries and return values.&lt;/P&gt;&lt;PRE class="lang-sql prettyprint prettyprinted"&gt;&lt;CODE&gt;&lt;SPAN class="pln"&gt;coustmer_NO  id   A1   A2   A3  A4   &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="lit"&gt;1&lt;/SPAN&gt;            &lt;SPAN class="lit"&gt;5&lt;/SPAN&gt;    &lt;SPAN class="lit"&gt;10&lt;/SPAN&gt;   &lt;SPAN class="lit"&gt;20&lt;/SPAN&gt;   &lt;SPAN class="lit"&gt;45&lt;/SPAN&gt;   &lt;SPAN class="lit"&gt;0&lt;/SPAN&gt;     
&lt;SPAN class="lit"&gt;1&lt;/SPAN&gt;            &lt;SPAN class="lit"&gt;13&lt;/SPAN&gt;   &lt;SPAN class="lit"&gt;0&lt;/SPAN&gt;    &lt;SPAN class="lit"&gt;45&lt;/SPAN&gt;   &lt;SPAN class="lit"&gt;2&lt;/SPAN&gt;    &lt;SPAN class="lit"&gt;5&lt;/SPAN&gt;  
&lt;SPAN class="lit"&gt;2&lt;/SPAN&gt;            &lt;SPAN class="lit"&gt;4&lt;/SPAN&gt;    &lt;SPAN class="lit"&gt;0&lt;/SPAN&gt;    &lt;SPAN class="lit"&gt;10&lt;/SPAN&gt;   &lt;SPAN class="lit"&gt;7&lt;/SPAN&gt;    &lt;SPAN class="lit"&gt;8&lt;/SPAN&gt;  
&lt;SPAN class="lit"&gt;2&lt;/SPAN&gt;            &lt;SPAN class="lit"&gt;3&lt;/SPAN&gt;    &lt;SPAN class="lit"&gt;7&lt;/SPAN&gt;    &lt;SPAN class="lit"&gt;9&lt;/SPAN&gt;    &lt;SPAN class="lit"&gt;55&lt;/SPAN&gt;   &lt;SPAN class="lit"&gt;0&lt;/SPAN&gt;        
&lt;SPAN class="lit"&gt;2&lt;/SPAN&gt;            &lt;SPAN class="lit"&gt;10&lt;/SPAN&gt;   &lt;SPAN class="lit"&gt;0&lt;/SPAN&gt;    &lt;SPAN class="lit"&gt;0&lt;/SPAN&gt;    &lt;SPAN class="lit"&gt;0&lt;/SPAN&gt;    &lt;SPAN class="lit"&gt;0&lt;/SPAN&gt;   
&lt;SPAN class="lit"&gt;3&lt;/SPAN&gt;            &lt;SPAN class="lit"&gt;4&lt;/SPAN&gt;    &lt;SPAN class="lit"&gt;90&lt;/SPAN&gt;   &lt;SPAN class="lit"&gt;8&lt;/SPAN&gt;    &lt;SPAN class="lit"&gt;14&lt;/SPAN&gt;   &lt;SPAN class="lit"&gt;3&lt;/SPAN&gt;             
&lt;SPAN class="lit"&gt;3&lt;/SPAN&gt;            &lt;SPAN class="lit"&gt;10&lt;/SPAN&gt;   &lt;SPAN class="lit"&gt;20&lt;/SPAN&gt;   &lt;SPAN class="lit"&gt;7&lt;/SPAN&gt;    &lt;SPAN class="lit"&gt;4&lt;/SPAN&gt;   &lt;SPAN class="lit"&gt;15&lt;/SPAN&gt;     &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;how to count the ID that has (value &amp;gt; 030) for each customer_no&lt;BR /&gt;then, the min number of values before 030 appears.&lt;/P&gt;&lt;P&gt;The expected output would be something like:&lt;/P&gt;&lt;PRE class="lang-sql prettyprint prettyprinted"&gt;&lt;CODE&gt;&lt;SPAN class="pln"&gt;cosutmer_no  &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;   count_ac_num &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;   &lt;SPAN class="kwd"&gt;values&lt;/SPAN&gt;   
&lt;SPAN class="lit"&gt;1&lt;/SPAN&gt;                   &lt;SPAN class="lit"&gt;2&lt;/SPAN&gt;            &lt;SPAN class="lit"&gt;1&lt;/SPAN&gt;    
&lt;SPAN class="lit"&gt;2&lt;/SPAN&gt;                   &lt;SPAN class="lit"&gt;1&lt;/SPAN&gt;            &lt;SPAN class="lit"&gt;1&lt;/SPAN&gt;   
&lt;SPAN class="lit"&gt;3&lt;/SPAN&gt;                   &lt;SPAN class="lit"&gt;1&lt;/SPAN&gt;            &lt;SPAN class="lit"&gt;3&lt;/SPAN&gt;   &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;first I need compare each A value to your cutoff of 30. Then perhaps i want to index number of the first A value that is &amp;gt; 30? And then&amp;nbsp;compare the&amp;nbsp;min of that over every row?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2017 18:18:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-different-value-in-excel-and-return-value/m-p/402200#M278809</guid>
      <dc:creator>ihlayyel</dc:creator>
      <dc:date>2017-10-08T18:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: Read different value in excel and return value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-different-value-in-excel-and-return-value/m-p/402202#M278810</link>
      <description>&lt;P&gt;You would have to explain where your values numbers come from. Why do customers 1 and 2 have values of 1, while customer 3 has a value of 3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2017 18:11:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-different-value-in-excel-and-return-value/m-p/402202#M278810</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-10-08T18:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: Read different value in excel and return value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-different-value-in-excel-and-return-value/m-p/402205#M278811</link>
      <description>Thank you so much for you comment:&lt;BR /&gt;&lt;BR /&gt;for costumer 1, in the two raw there is a value bigger than &amp;gt;30. Then select the min number of cells which is in the first row, that have A4 only. that is why its 1 .&lt;BR /&gt;&lt;BR /&gt;for customer 2 : there is only one value &amp;gt;30 . and only one value which is A4.&lt;BR /&gt;&lt;BR /&gt;for customer 3 : there is one value &amp;gt; 30. and there is three values before it which are A2, A3 and A4.&lt;BR /&gt;</description>
      <pubDate>Sun, 08 Oct 2017 18:26:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-different-value-in-excel-and-return-value/m-p/402205#M278811</guid>
      <dc:creator>ihlayyel</dc:creator>
      <dc:date>2017-10-08T18:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: Read different value in excel and return value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-different-value-in-excel-and-return-value/m-p/402214#M278812</link>
      <description>&lt;P&gt;If there is a maximum of one a1 to a4 value that can be greater than 30, then the following should work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input customer_NO  id   A1-A4;
  cards; 
1            5    10   20   45   0     
1            13   0    45   2    5  
2            4    0    10   7    8  
2            3    7    9    55   0        
2            10   0    0    0    0   
3            4    90   8    14   3             
3            10   20   7    4   15
;

data want (keep=customer_NO count_ac_num values);
  set have;
  by customer_NO;
  if first.customer_NO then do;
    count_ac_num=0;
    values=4;
  end;
  retain values;
  array a_array(*) a1-a4;
  do i=1 to dim(a_array);
    if a_array(i) gt 30 then do;
      count_ac_num+1;
      values=min(values,dim(a_array)-i);
      leave;
    end;
    else if i eq dim(a_array) then values=min(values,dim(a_array));
  end;
  if last.customer_NO then output;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Otherwise, you'll have to specify how you'd want to treat VALUES in such cases.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2017 19:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-different-value-in-excel-and-return-value/m-p/402214#M278812</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-10-08T19:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Read different value in excel and return value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-different-value-in-excel-and-return-value/m-p/402282#M278813</link>
      <description>##-&lt;BR /&gt;&lt;BR /&gt;69 data want4 (keep=customer_NO count_ac_num values);&lt;BR /&gt;70 set WORK.test;&lt;BR /&gt;71 by customer_NO;&lt;BR /&gt;72 if first.customer_NO then do;&lt;BR /&gt;73 count_ac_num=0;&lt;BR /&gt;74 values=4;&lt;BR /&gt;75 end;&lt;BR /&gt;76 retain values;&lt;BR /&gt;77 array a_array(*) a1-a4;&lt;BR /&gt;78 do i=1 to dim(a_array);&lt;BR /&gt;79 if a_array(i) gt 30 then do;&lt;BR /&gt;80 count_ac_num+1;&lt;BR /&gt;81 values=min(values,dim(a_array)-i);&lt;BR /&gt;82 leave;&lt;BR /&gt;83 end;&lt;BR /&gt;84 else if i eq dim(a_array) then values=min(values,dim(a_array));&lt;BR /&gt;85 end;&lt;BR /&gt;86 if last.customer_NO then output;&lt;BR /&gt;87 run;&lt;BR /&gt;ERROR: BY variables are not properly sorted on data set WORK.TEST.&lt;BR /&gt;customer_no=3 acct_type=10 a1=0 a2=30 a3=0 a4=0 FIRST.customer_no=0 LAST.customer_no=0 count_ac_num=0 values=4 i=. _ERROR_=1 _N_=8&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: There were 9 observations read from the data set WORK.TEST.&lt;BR /&gt;-##</description>
      <pubDate>Mon, 09 Oct 2017 06:18:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-different-value-in-excel-and-return-value/m-p/402282#M278813</guid>
      <dc:creator>ihlayyel</dc:creator>
      <dc:date>2017-10-09T06:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: Read different value in excel and return value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-different-value-in-excel-and-return-value/m-p/402288#M278814</link>
      <description>Read the log, the error message has an obvious solution.</description>
      <pubDate>Mon, 09 Oct 2017 07:03:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-different-value-in-excel-and-return-value/m-p/402288#M278814</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2017-10-09T07:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Read different value in excel and return value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-different-value-in-excel-and-return-value/m-p/402290#M278815</link>
      <description>Iam still can't figure it out.</description>
      <pubDate>Mon, 09 Oct 2017 07:29:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-different-value-in-excel-and-return-value/m-p/402290#M278815</guid>
      <dc:creator>ihlayyel</dc:creator>
      <dc:date>2017-10-09T07:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: Read different value in excel and return value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-different-value-in-excel-and-return-value/m-p/402357#M278816</link>
      <description>&lt;P&gt;Assuming I understand what you are talking about.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input customer_NO  id   A1-A4;
  cards; 
1            5    10   20   45   0     
1            13   0    45   2    5  
2            4    0    10   7    8  
2            3    7    9    55   0        
2            10   0    0    0    0   
3            4    90   8    14   3             
3            10   20   7    4   15
;

proc sql;
select customer_NO,
sum(A1&amp;gt;30) as a1,
sum(A2&amp;gt;30) as a2,
sum(A3&amp;gt;30) as a3,
sum(A4&amp;gt;30) as a4,
calculated a1+calculated a2+calculated a3+calculated a4 as count_ac_num ,
case when 
calculated a1=0 and calculated a2=0 and calculated a3=0 and calculated a4=0 then 4
when
calculated a2=0 and calculated a3=0 and calculated a4=0 then 3
when
calculated a3=0 and calculated a4=0 then 2
when
calculated a4=0 then 1
else 0 end as values   
 from have
  group by customer_NO;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Oct 2017 13:18:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-different-value-in-excel-and-return-value/m-p/402357#M278816</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-10-09T13:18:43Z</dc:date>
    </item>
  </channel>
</rss>

