<?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: Replacing missing values with zeroes in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-missing-values-with-zeroes/m-p/1819#M596</link>
    <description>Is it possible to replace the missing values with zeroes only on variables ending with "_q" ?&lt;BR /&gt;
Thanks in advance.</description>
    <pubDate>Mon, 12 Oct 2009 11:56:45 GMT</pubDate>
    <dc:creator>Siva_economist</dc:creator>
    <dc:date>2009-10-12T11:56:45Z</dc:date>
    <item>
      <title>Replacing missing values with zeroes</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-missing-values-with-zeroes/m-p/1814#M591</link>
      <description>Sounds easy, but I am not actually trying to replace the missing values with zeroes in a single column... I have some 250 columns representing fish species which I do not want to   work on individually.&lt;BR /&gt;
&lt;BR /&gt;
EG 4.1 can change column values in the query menu fairly easily, but I haven't found a way to automate this for all columns.&lt;BR /&gt;
&lt;BR /&gt;
The Update statement in proc SQL can also easily change the missing values, but one variable at a time.&lt;BR /&gt;
&lt;BR /&gt;
My question is: is it possible to batch proccess an entire dataset for this task? With some loop or special reference? &lt;BR /&gt;
&lt;BR /&gt;
Thanks for your help!</description>
      <pubDate>Mon, 20 Nov 2006 18:34:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-missing-values-with-zeroes/m-p/1814#M591</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-11-20T18:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing values with zeroes</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-missing-values-with-zeroes/m-p/1815#M592</link>
      <description>Marc:&lt;BR /&gt;
  Run this test program and see if it does what you want. It uses sashelp.class -- so you should be able to run it. You really only care about the array technique used in the second Data step program, but I needed to make up some missing data to test the program.&lt;BR /&gt;
cynthia&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
** make some data with missing values;&lt;BR /&gt;
data newclass;&lt;BR /&gt;
  set sashelp.class;&lt;BR /&gt;
  if age = 13 then height = .;&lt;BR /&gt;
  else if age = 12 then weight = .;&lt;BR /&gt;
  else if age = 15 then do;&lt;BR /&gt;
     height = .;&lt;BR /&gt;
     weight = .;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
  &lt;BR /&gt;
proc print data=newclass;&lt;BR /&gt;
title 'should have some missing';&lt;BR /&gt;
run;&lt;BR /&gt;
  &lt;BR /&gt;
** For every observations, treat the numeric vars as though;&lt;BR /&gt;
** they are in an array and use a do loop to set missing;&lt;BR /&gt;
** to 0;&lt;BR /&gt;
data fixmiss;&lt;BR /&gt;
drop i;&lt;BR /&gt;
  set newclass;&lt;BR /&gt;
  array fix(*) _numeric_;&lt;BR /&gt;
  do i = 1 to dim(fix);&lt;BR /&gt;
     fix(i) = sum(fix(i),0);&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
  &lt;BR /&gt;
proc print data=fixmiss;&lt;BR /&gt;
title 'missing should be fixed';&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Mon, 20 Nov 2006 21:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-missing-values-with-zeroes/m-p/1815#M592</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2006-11-20T21:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing values with zeroes</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-missing-values-with-zeroes/m-p/1816#M593</link>
      <description>That worked great!&lt;BR /&gt;
&lt;BR /&gt;
Many thanks!&lt;BR /&gt;
&lt;BR /&gt;
Marc</description>
      <pubDate>Mon, 20 Nov 2006 23:43:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-missing-values-with-zeroes/m-p/1816#M593</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-11-20T23:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing values with zeroes</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-missing-values-with-zeroes/m-p/1817#M594</link>
      <description>Does anybody know if there any way to replace the missing values with zeroes for many columns WITHOUT USING A DATA STEP?&lt;BR /&gt;
Thanks</description>
      <pubDate>Thu, 14 Dec 2006 14:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-missing-values-with-zeroes/m-p/1817#M594</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-12-14T14:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing values with zeroes</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-missing-values-with-zeroes/m-p/1818#M595</link>
      <description>Try:&lt;BR /&gt;
  OPTIONS MISSING = '0';&lt;BR /&gt;
&lt;BR /&gt;
This doesn't change the missing values, but displays them as '0'.&lt;BR /&gt;
&lt;BR /&gt;
........Phil Holland</description>
      <pubDate>Wed, 20 Dec 2006 15:39:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-missing-values-with-zeroes/m-p/1818#M595</guid>
      <dc:creator>prholland</dc:creator>
      <dc:date>2006-12-20T15:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing values with zeroes</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-missing-values-with-zeroes/m-p/1819#M596</link>
      <description>Is it possible to replace the missing values with zeroes only on variables ending with "_q" ?&lt;BR /&gt;
Thanks in advance.</description>
      <pubDate>Mon, 12 Oct 2009 11:56:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-missing-values-with-zeroes/m-p/1819#M596</guid>
      <dc:creator>Siva_economist</dc:creator>
      <dc:date>2009-10-12T11:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing missing values with zeroes</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-missing-values-with-zeroes/m-p/1820#M597</link>
      <description>SAS data step code makes it easy to reference name prefix lists (e.g. all variables starting with q_) but unfortunately not what you're describing with a common suffix. In order to do that, I would write some SAS code to create a list of variable names as the value for a macro variable, then reference that macro variable in data step code similar to what Cynthia showed above.&lt;BR /&gt;
&lt;BR /&gt;
Run the following code, then use the final data step shown by Cynthia. However, in that code, replace _numeric_ on the ARRAY statement with &amp;amp;qlist (the name of the macro variable we created). That should do the trick.&lt;BR /&gt;
&lt;BR /&gt;
  /* Create test data set */&lt;BR /&gt;
data work.test1;&lt;BR /&gt;
  set sashelp.class;&lt;BR /&gt;
  if mod(_N_,2) = 1 then height=.;&lt;BR /&gt;
    /* Every second height missing */&lt;BR /&gt;
  if mod(_N_,5) = 1 then age=.;&lt;BR /&gt;
    /* Every fifth age missing */&lt;BR /&gt;
  rename height=height_q age=age_q;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
  select name&lt;BR /&gt;
      into : qlist separated by ", "&lt;BR /&gt;
    from dictionary.columns&lt;BR /&gt;
    where libname="WORK" &lt;BR /&gt;
      and memname="TEST1"&lt;BR /&gt;
      and upcase(name) like '%_Q';&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
%put &amp;amp;qlist;</description>
      <pubDate>Mon, 12 Oct 2009 12:50:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-missing-values-with-zeroes/m-p/1820#M597</guid>
      <dc:creator>RichardH_sas</dc:creator>
      <dc:date>2009-10-12T12:50:21Z</dc:date>
    </item>
  </channel>
</rss>

