<?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: Proc Means and zero values in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64224#M18263</link>
    <description>wonder how they'll get the reports they need &lt;BR /&gt;
without SAS</description>
    <pubDate>Fri, 02 Apr 2010 08:42:42 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2010-04-02T08:42:42Z</dc:date>
    <item>
      <title>Proc Means and zero values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64216#M18255</link>
      <description>Hi,&lt;BR /&gt;
i have written the following code&lt;BR /&gt;
&lt;BR /&gt;
proc means data = dataset1 EXCLNPWGT;&lt;BR /&gt;
	class Strategy;&lt;BR /&gt;
	var  VALUE;&lt;BR /&gt;
	output out = datasetResults;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
I have alot of zeros in the value column and they are showing in the results, should the EXCLNPWGT option not ignore the zeroes and show me a true value?&lt;BR /&gt;
&lt;BR /&gt;
Any help would be great &lt;BR /&gt;
&lt;BR /&gt;
Cheers&lt;BR /&gt;
Mike</description>
      <pubDate>Wed, 03 Mar 2010 16:47:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64216#M18255</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-03-03T16:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means and zero values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64217#M18256</link>
      <description>There is topic-reference info at the SAS support &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website and a link to the latest version discussion is provided.  Suggest you share some results, not just SAS code, for feedback.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
SAS Procedures Guide, Results: MEANS Procedure&lt;BR /&gt;
Missing Values&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a002473538.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a002473538.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Recommended Google advanced search argument, this topic/post:&lt;BR /&gt;
means zero value site:sas.com</description>
      <pubDate>Wed, 03 Mar 2010 17:14:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64217#M18256</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-03-03T17:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means and zero values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64218#M18257</link>
      <description>hi ... the option EXCLNPWGT will look at the variable in a WEIGHT statement&lt;BR /&gt;
&lt;BR /&gt;
from on-line DOC ... "EXCLNPWGT excludes observations with nonpositive weight values (zero or negative) from the analysis"&lt;BR /&gt;
&lt;BR /&gt;
it does not say with zero values of the analysis variable&lt;BR /&gt;
&lt;BR /&gt;
if you want to exclude observations with zero values for the variable VALUE, how about using a WHERE statement ...&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc means data = dataset1;&lt;BR /&gt;
where value ne 0;&lt;BR /&gt;
class Strategy;&lt;BR /&gt;
var VALUE;&lt;BR /&gt;
output out = datasetResults;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
for example, you get two different answers with this ...&lt;BR /&gt;
[pre]&lt;BR /&gt;
data test;&lt;BR /&gt;
input x y @@;&lt;BR /&gt;
datalines;&lt;BR /&gt;
0 1 2 1 3 1 4 0&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
title 'EXCLUDE ZERO WEIGHTS';&lt;BR /&gt;
proc means data=test EXCLNPWGTS;&lt;BR /&gt;
var x;&lt;BR /&gt;
weight y;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
title 'EXCLUDE ZERO VALUES';&lt;BR /&gt;
proc means data=test;&lt;BR /&gt;
where x ne 0;&lt;BR /&gt;
var x;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
EXCLUDE ZERO WEIGHTS&lt;BR /&gt;
N           Mean         Std Dev         Minimum         Maximum&lt;BR /&gt;
3       1.6666667       1.5275252               0       3.0000000&lt;BR /&gt;
&lt;BR /&gt;
EXCLUDE ZERO VALUES&lt;BR /&gt;
N            Mean         Std Dev        Minimum         Maximum&lt;BR /&gt;
3       3.0000000      1.0000000    2.0000000       4.0000000&lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 03 Mar 2010 17:22:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64218#M18257</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2010-03-03T17:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means and zero values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64219#M18258</link>
      <description>thanks for the help mike, simple when you think about it i suppose. I was hoping to do this for quite a few columns so hoped that there was an easier solution as i imagine thi swill not work on many columns.&lt;BR /&gt;
&lt;BR /&gt;
looks like i will have to write a macro to process each column individually&lt;BR /&gt;
&lt;BR /&gt;
Cheers&lt;BR /&gt;
for the suggestion&lt;BR /&gt;
Mike</description>
      <pubDate>Wed, 03 Mar 2010 19:09:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64219#M18258</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-03-03T19:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means and zero values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64220#M18259</link>
      <description>How about creating a view that changes all the zeros to missing.   Then you can still use one call to proc means for all vars.  No macros involved.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data no0 / view=no0;&lt;BR /&gt;
   set ....;&lt;BR /&gt;
   array _0&lt;LI&gt; varA-numeric-Varz;&lt;BR /&gt;
   do _n_ = 1 to dim(_0);&lt;BR /&gt;
      if _0[_n_]  eq 0 then _0[_n_] = .;&lt;BR /&gt;
      end;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]&lt;/LI&gt;</description>
      <pubDate>Wed, 03 Mar 2010 22:09:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64220#M18259</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-03-03T22:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means and zero values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64221#M18260</link>
      <description>I caution you that it may not be a valid statistical analysis to exclude zeros from your mean values — of course, you may have a valid reason for doing so, but you haven't stated this.</description>
      <pubDate>Thu, 04 Mar 2010 15:10:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64221#M18260</guid>
      <dc:creator>Paige</dc:creator>
      <dc:date>2010-03-04T15:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means and zero values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64222#M18261</link>
      <description>thanks for the advice paige, the zeros had been removed at the request of the customer as they would not have any history with the product.</description>
      <pubDate>Thu, 04 Mar 2010 16:11:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64222#M18261</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-03-04T16:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means and zero values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64223#M18262</link>
      <description>thanks for your code data _null_, it has been used to remove the zero values. I ended up building  a macro to do each column individually as i could get the proc means to give me the answer required. I was also informed that our sas licenses are not going to be renewed so didn't want to spend too much time learning anything new..... gutted!!</description>
      <pubDate>Thu, 04 Mar 2010 16:19:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64223#M18262</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-03-04T16:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means and zero values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64224#M18263</link>
      <description>wonder how they'll get the reports they need &lt;BR /&gt;
without SAS</description>
      <pubDate>Fri, 02 Apr 2010 08:42:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64224#M18263</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-04-02T08:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means and zero values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64225#M18264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I have a very simple question;&lt;/P&gt;&lt;P&gt;in case I am using multiple variables in var statement of proc means and I want to calculate average for all of them based on non zero values then How should approach the where statement in the proc means ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Sep 2014 06:41:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64225#M18264</guid>
      <dc:creator>Rathod</dc:creator>
      <dc:date>2014-09-19T06:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means and zero values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64226#M18265</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;Please note that the post is 4 years old - start a new post.&amp;nbsp; In answer to your question, why not go with Data _null_;'s suggestion of using arrays:&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;&amp;nbsp; a=1; b=4; c=0; d=3; output;&lt;BR /&gt;&amp;nbsp; a=4; b=4; c=1; d=5; output;&lt;BR /&gt;run;&lt;BR /&gt;data inter (keep=res1-res4);&lt;BR /&gt;&amp;nbsp; set have;&lt;BR /&gt;&amp;nbsp; array var{4} a b c d;&lt;BR /&gt;&amp;nbsp; array res{4};&lt;BR /&gt;&amp;nbsp; do i=1 to 4;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if var{i}=0 then res{i}=.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else res{i}=var{i};&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc means data=inter;&lt;BR /&gt;&amp;nbsp; var res1-res4;&lt;BR /&gt;&amp;nbsp; output out=test;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Sep 2014 08:54:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-zero-values/m-p/64226#M18265</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-09-19T08:54:46Z</dc:date>
    </item>
  </channel>
</rss>

