<?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: Conditional Array to recode missing to zero in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Array-to-recode-missing-to-zero/m-p/547614#M151769</link>
    <description>&lt;P&gt;Since you have three DO statements and only two END statements the error message is pretty clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From your requirements you just need to do something like this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data gls.txrecoded;
  set gls.secondarytasp;
  array name txsnum_k12 txsnum_hed txsnum_sab txsnum_jj txsnum_er txsnum_tstg txsnum_cw txsnum_mh txsnum_phc;
  if n(of name(*)) then do i=1 to dim(name);
      name(i)=sum(0,name(i));
  end;
  drop i;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 01 Apr 2019 13:24:31 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-04-01T13:24:31Z</dc:date>
    <item>
      <title>Conditional Array to recode missing to zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Array-to-recode-missing-to-zero/m-p/547486#M151727</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a range of numeric variables (txn_a, txn_b, txn_c...) in my dataset that I need to recode missing to zero depending each other's response.&amp;nbsp;The condition is that if any variables in this range is NOT missng the others variables missing should be recoded to zero.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas how can I can accomplish that with an array?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 31 Mar 2019 14:41:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Array-to-recode-missing-to-zero/m-p/547486#M151727</guid>
      <dc:creator>sofiacvp</dc:creator>
      <dc:date>2019-03-31T14:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Array to recode missing to zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Array-to-recode-missing-to-zero/m-p/547487#M151728</link>
      <description>&lt;P&gt;Use a flag to assign an existing missing value in the array,&lt;/P&gt;
&lt;P&gt;then, according to flag value, replace missing by zero:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array name txn_a ... ;
flag=0;
do i=1 to dim(name);
    if name(i)=. then do;
       do while (i le dim(name));
            flag=1;
            if name(i) = . then name(i) = 0;
            i+1;
        end;
        if flag=1 then leave;
end;
drop flag;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 31 Mar 2019 14:53:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Array-to-recode-missing-to-zero/m-p/547487#M151728</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-03-31T14:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Array to recode missing to zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Array-to-recode-missing-to-zero/m-p/547601#M151765</link>
      <description>&lt;P&gt;I keep getting the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2754 run;&lt;BR /&gt;-&lt;BR /&gt;117&lt;BR /&gt;ERROR 117-185: There was 1 unclosed DO block.&lt;/P&gt;&lt;P&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data gls.txrecoded;&lt;BR /&gt;set gls.secondarytasp;&lt;BR /&gt;array name (9) txsnum_k12 txsnum_hed txsnum_sab txsnum_jj txsnum_er txsnum_tstg txsnum_cw txsnum_mh txsnum_phc;&lt;BR /&gt;flag=0;&lt;BR /&gt;do i=1 to dim(name);&lt;BR /&gt;if name(i)=. then do;&lt;BR /&gt;do while (i le dim(name));&lt;BR /&gt;flag=1;&lt;BR /&gt;if name(i) = . then name(i) = 0;&lt;BR /&gt;i+1;&lt;BR /&gt;end;&lt;BR /&gt;if flag=1 then leave;&lt;BR /&gt;end;&lt;BR /&gt;drop flag;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 12:22:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Array-to-recode-missing-to-zero/m-p/547601#M151765</guid>
      <dc:creator>sofiacvp</dc:creator>
      <dc:date>2019-04-01T12:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Array to recode missing to zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Array-to-recode-missing-to-zero/m-p/547614#M151769</link>
      <description>&lt;P&gt;Since you have three DO statements and only two END statements the error message is pretty clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From your requirements you just need to do something like this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data gls.txrecoded;
  set gls.secondarytasp;
  array name txsnum_k12 txsnum_hed txsnum_sab txsnum_jj txsnum_er txsnum_tstg txsnum_cw txsnum_mh txsnum_phc;
  if n(of name(*)) then do i=1 to dim(name);
      name(i)=sum(0,name(i));
  end;
  drop i;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Apr 2019 13:24:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Array-to-recode-missing-to-zero/m-p/547614#M151769</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-01T13:24:31Z</dc:date>
    </item>
  </channel>
</rss>

