<?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: How to set all missing values to zero for all variables? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/357165#M64269</link>
    <description>&lt;P&gt;Extremely helpful solution!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I googled this topic this was one of the first posts that came up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 May 2017 13:06:20 GMT</pubDate>
    <dc:creator>LauraJean</dc:creator>
    <dc:date>2017-05-09T13:06:20Z</dc:date>
    <item>
      <title>How to set all missing values to zero for all variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/41478#M10728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am looking for an easy way to set all missing values to zero for all variables in a dataset. There are over 50 variables which takes too much work to do it manually.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Aug 2011 10:59:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/41478#M10728</guid>
      <dc:creator>bncoxuk</dc:creator>
      <dc:date>2011-08-03T10:59:41Z</dc:date>
    </item>
    <item>
      <title>How to set all missing values to zero for all variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/41479#M10729</link>
      <description>&lt;P&gt;&lt;EM&gt;Editor's note: This topic is&amp;nbsp;&lt;STRONG&gt;very&lt;/STRONG&gt; popular. &amp;nbsp;Thanks to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16755"&gt;@ieva﻿&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__﻿&lt;/a&gt;&amp;nbsp;for useful replies. &amp;nbsp;We've consolidated those here to make it easier for future learners.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suppose, you want to change all numeric variables. Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data yourdata;
&amp;nbsp;&amp;nbsp; set yourdata;
&amp;nbsp;&amp;nbsp; array change _numeric_;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do over change;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if change=. then change=0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;
&amp;nbsp;run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;EM&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16755"&gt;@ieva﻿&lt;/a&gt;'s solution works well with Base SAS. &amp;nbsp;If you have SAS/STAT (most users do), then you can use &lt;A href="http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_stdize_syntax01.htm" target="_self"&gt;PROC STDIZE&lt;/A&gt; as shared by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__﻿&lt;/a&gt;:&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* create test data set */
data missing;
   set sashelp.class;
   if mod(_n_,2) eq 1 then call missing(of _numeric_);
   run;

proc print;
   run;
proc stdize out=zeros reponly missing=0;
   run;
proc print;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 15:56:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/41479#M10729</guid>
      <dc:creator>ieva</dc:creator>
      <dc:date>2016-07-07T15:56:39Z</dc:date>
    </item>
    <item>
      <title>How to set all missing values to zero for all variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/41480#M10730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can do that with PROC STDIZE, too. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; missing;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; sashelp.class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; mod(_n_,&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;) eq &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; missing(of _numeric_);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;print&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;stdize&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;=zeros &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;reponly&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;missing&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;print&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Aug 2011 11:22:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/41480#M10730</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-08-03T11:22:32Z</dc:date>
    </item>
    <item>
      <title>How to set all missing values to zero for all variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/41481#M10731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for sharing good idea.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Aug 2011 15:26:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/41481#M10731</guid>
      <dc:creator>bncoxuk</dc:creator>
      <dc:date>2011-08-03T15:26:30Z</dc:date>
    </item>
    <item>
      <title>How to set all missing values to zero for all variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/41482#M10732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your consistent help. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Aug 2011 15:27:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/41482#M10732</guid>
      <dc:creator>bncoxuk</dc:creator>
      <dc:date>2011-08-03T15:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to set all missing values to zero for all variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/41483#M10733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And of course for characters variables u Can replace &lt;STRONG&gt;_numeric_&lt;/STRONG&gt; with &lt;STRONG&gt;_character_&lt;/STRONG&gt; :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: navy;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; yourdata;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; yourdata;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; change &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;_character_&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;do&lt;/SPAN&gt; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;over&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; change;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; change=&lt;/SPAN&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: teal;"&gt;.&lt;/STRONG&gt; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; change=&lt;/SPAN&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: teal;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: navy;"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Oct 2014 13:12:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/41483#M10733</guid>
      <dc:creator>lordfox84</dc:creator>
      <dc:date>2014-10-24T13:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to set all missing values to zero for all variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/270376#M58222</link>
      <description>&lt;P&gt;Whoever posted the solution, this is awesome. &amp;nbsp;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2016 15:30:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/270376#M58222</guid>
      <dc:creator>fedora_ed_sc_gov</dc:creator>
      <dc:date>2016-05-13T15:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to set all missing values to zero for all variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/295305#M60126</link>
      <description>What about "options missing=0"?</description>
      <pubDate>Tue, 30 Aug 2016 20:03:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/295305#M60126</guid>
      <dc:creator>Tim_Taylor</dc:creator>
      <dc:date>2016-08-30T20:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to set all missing values to zero for all variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/295551#M60154</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/24284"&gt;@Tim_Taylor&lt;/a&gt; wrote:&lt;BR /&gt;What about "options missing=0"?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you need the value to be 0 such as for modeling then the value needs to be set. The Missing option only effects display such as in table views or proc displayed output, not data values.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2016 15:50:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/295551#M60154</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-08-31T15:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to set all missing values to zero for all variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/295755#M60161</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know that it is an old topic, but I would like to add a new possible solution, using Proc LUA (please, note that I'm using 9.4 M2 and not M3);&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Create example dataset*/
data missing;
set sashelp.class;
if mod(_n_,2) eq 1 then call missing(of _numeric_);
run;

/*The procedure itself*/
proc lua;
submit;
   local dsid = sas.open("work.missing","u") -- open in update mode            
   local vars = {}

   -- Iterate over the variables in the data set
   for var in sas.vars(dsid) do
      vars[var.name:lower()] = var               
   end

   -- Iterate over the rows of the data set   
	 while sas.next(dsid) do
	 	 for vname,var in pairs(vars) do
		 	if sas.is_missing(sas.get_value(dsid, vname)) then
				dsid:put_value(vname,0) 
				sas.update(dsid)
			end --End if
   end  --End for
	end --End while
  sas.close(dsid)
endsubmit;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Sep 2016 09:39:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/295755#M60161</guid>
      <dc:creator>fetcs74</dc:creator>
      <dc:date>2016-09-01T09:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to set all missing values to zero for all variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/295905#M60165</link>
      <description>&lt;P&gt;Interesting! Good way to learn PROC LUA, and it looks like your approach updates the data "in place", at least conceptually.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 15:55:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/295905#M60165</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2016-09-01T15:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to set all missing values to zero for all variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/309615#M61252</link>
      <description>&lt;P&gt;What if you want to set varibles to missing based on a condition.&lt;/P&gt;&lt;P&gt;Like, if ( X and Y and B and G and D and Y and Z)=. then all variables in this array group = 88&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;is that possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Nov 2016 20:20:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/309615#M61252</guid>
      <dc:creator>teeAepi</dc:creator>
      <dc:date>2016-11-06T20:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to set all missing values to zero for all variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/357165#M64269</link>
      <description>&lt;P&gt;Extremely helpful solution!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I googled this topic this was one of the first posts that came up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2017 13:06:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/357165#M64269</guid>
      <dc:creator>LauraJean</dc:creator>
      <dc:date>2017-05-09T13:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to set all missing values to zero for all variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/429860#M68567</link>
      <description>How would i select specific variables only and replace the missing values with 0?</description>
      <pubDate>Tue, 23 Jan 2018 02:37:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/429860#M68567</guid>
      <dc:creator>ChrisGermain</dc:creator>
      <dc:date>2018-01-23T02:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to set all missing values to zero for all variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/429908#M68575</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc stdize out=zeros reponly missing=0;
   var MyVariable;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Use a var statement in PROC STDIZE&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 08:23:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/429908#M68575</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-01-23T08:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to set all missing values to zero for all variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/430095#M68586</link>
      <description>&lt;P&gt;Thank you very much! One other question:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) How can I replace a missing value for a different variable using the mean of a group?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have missing values for a variable "area" and I want to replace the missing values with the mean of "area" by "neighborhood", where values are not missing.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 17:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/430095#M68586</guid>
      <dc:creator>ChrisGermain</dc:creator>
      <dc:date>2018-01-23T17:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to set all missing values to zero for all variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/430115#M68588</link>
      <description>&lt;P&gt;Use PROC STDIZE as in the replace with zero case and use the MISSING=MEAN instead and the BY Statement to specify your By-Group&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 18:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-set-all-missing-values-to-zero-for-all-variables/m-p/430115#M68588</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-01-23T18:44:24Z</dc:date>
    </item>
  </channel>
</rss>

