<?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 or other procedure for mean/quartiles in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105456#M29417</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, can you please point me to the lifetest resource?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, on the function to export results of this into a file, the below code is part of a much larger set of code. Is there parameter that just points to a specific PROC or DATA section of code and not the whole thing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods tagsets.excelxp file='Temp.xml';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc means data=s10sorted median q1 q3 stddev;&lt;/P&gt;&lt;P&gt;var dur_filing_issuejoin dur_issuejoin_dispo;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods tagsets.excelxp close;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Oct 2012 17:02:57 GMT</pubDate>
    <dc:creator>Paul_NYS</dc:creator>
    <dc:date>2012-10-24T17:02:57Z</dc:date>
    <item>
      <title>Proc Means or other procedure for mean/quartiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105452#M29413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have a few questions on how to calculate a mean/quartile:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. I have a data set that has two variables that I want to calculate the mean and other quartiles for. The below statement returns what appears to be the means and the first and third quartiles. From a code perspective, is this correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc means data=s10sorted median q1 q3 stddev;&lt;/P&gt;&lt;P&gt;var dur_filing_issuejoin dur_issuejoin_dispo;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. In the columns for the above variables, I have many null values that I want to factor into the median/quart. In other words, I do not want to calculate a mean or quartile if 50% (or 75% for 3rd quartile) of the observations have not occurred yet. I am assuming the above procedure just calculates the mean/quart for the numbers that are there, so it doesn't care if the appropriate number of obs have occurred?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. I need to export this to a spreadsheet and am unfamiliar with how to do this. I know proc print prints out to screen. Is there another way to generate a .csv, .txt, or .xls?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 15:57:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105452#M29413</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2012-10-24T15:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means or other procedure for mean/quartiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105453#M29414</link>
      <description>&lt;P&gt;&lt;EM&gt;Editor's Note: Thanks to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;for providing the answer that addressed the original question and for pointing to an alternative using PROC LIFETEST.&amp;nbsp;Most Base procedures, including PROC MEANS and PROC RANK, will exclude missing values before calculating statistics. Changing missing values to 0 in advance would not help in this case. If you don't want a statistic to be calculated if there are not enough non-missing values, you would need to check in advance for the number of non-missing values and then use macro logic to conditionally execute the code based on that number.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. This is correct, but why would you calculate stddev but quartiles? Stdev is usually used with the mean?&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp; Does this mean you want to exclude your null values?&amp;nbsp; If they're coded as missing, SAS will exclude them, if you're looking at doing something else, like censoring you might want to consider proc lifetest instead but it depends on your data and your question.&lt;/P&gt;
&lt;P&gt;3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods tagsets.excelxp file='Temp.xml';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc means data=s10sorted median q1 q3 stddev;&lt;/P&gt;
&lt;P&gt;var dur_filing_issuejoin dur_issuejoin_dispo;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods tagsets.excelxp close;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2017 18:09:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105453#M29414</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-06T18:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means or other procedure for mean/quartiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105454#M29415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Reeza.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. I was experimenting with proc means, so stdev was just part of that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. No, I want the null values to be factored in. What I want to do is to be sure the median and quartile calculations are done when 50% or 75% of the observations have actually occurred. I don't want to calculate the either based on SAS just calculating it for the values that are present.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if I have 10 potential observations and only 4 of them have occurred as of a certain date, I should not be able to calculate a median for that variable. The way proc means seems to work is that it will calculate a median for the 4 present values and exclude the 6 that are missing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now if there were 5 observations (out of 10), I should be able to calculate a median because half of the observations have occurred and it doesn't matter what the remaining values are, they are already past the median point.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I am wondering if this is something that must be coded or whether there is a configuration or another procedure that accomplishes this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Thank you. I will try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 16:49:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105454#M29415</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2012-10-24T16:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means or other procedure for mean/quartiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105455#M29416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you need to look into survival analysis and the Kaplan Meier Curve and see if its what you're looking for.&lt;/P&gt;&lt;P&gt;The related SAS procedure is proc lifetest, if you provide a bit about the subject matter I can help direct you to a relevant resource.&lt;/P&gt;&lt;P&gt;There are slight difference in terms when looking at churn models for sales, survival of patients and failure of products in a manufacturing industry.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 16:54:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105455#M29416</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-10-24T16:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means or other procedure for mean/quartiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105456#M29417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, can you please point me to the lifetest resource?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, on the function to export results of this into a file, the below code is part of a much larger set of code. Is there parameter that just points to a specific PROC or DATA section of code and not the whole thing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods tagsets.excelxp file='Temp.xml';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc means data=s10sorted median q1 q3 stddev;&lt;/P&gt;&lt;P&gt;var dur_filing_issuejoin dur_issuejoin_dispo;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods tagsets.excelxp close;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 17:02:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105456#M29417</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2012-10-24T17:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means or other procedure for mean/quartiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105457#M29418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="http://www.statsoft.com/textbook/survival-failure-time-analysis/" title="http://www.statsoft.com/textbook/survival-failure-time-analysis/"&gt; Survival/Failure Time Analysis&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.ats.ucla.edu/stat/SAS/seminars/sas_survival/default.htm" title="http://www.ats.ucla.edu/stat/SAS/seminars/sas_survival/default.htm"&gt;Introduction to Survival Analysis with SAS Seminar&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can create an output data set from proc means and then export that out instead using proc means.&lt;/P&gt;&lt;P&gt;Here's a paper on that. If you have 9.3 you may want to look into the stackODS option as well.&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.lexjansen.com/wuss/2008/ess/ess09.pdf" title="http://www.lexjansen.com/wuss/2008/ess/ess09.pdf"&gt;http://www.lexjansen.com/wuss/2008/ess/ess09.pdf&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 17:53:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105457#M29418</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-10-24T17:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means or other procedure for mean/quartiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105458#M29419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or Maybe you can check PROC RANKS , which might be your demand .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2012 02:43:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105458#M29419</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-10-25T02:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means or other procedure for mean/quartiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105459#M29420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PROC RANK with the percent option, and then use if logic to identify the quartiles in a data step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proc rank data=data1 out=data2 percent;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var quartile-variable;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ranks percentile;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data data3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set data2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if percentile &amp;lt; .25 then quartile=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if percentile &amp;lt; .5 then quartile = 2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if percentile &amp;lt; .75 then quartile = 3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else quartile=4;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2012 14:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105459#M29420</guid>
      <dc:creator>cau83</dc:creator>
      <dc:date>2012-11-02T14:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means or other procedure for mean/quartiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105460#M29421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Proc rank will not necessarily work because the percent option only calculates percents for non-missing values: "Percent: divides each rank by the number of observations that have nonmissing values of the variable and multiplies the result by 100 to get a percentage...."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While this makes sense, I need to factor in missing values in determining a median.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Nov 2012 12:43:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105460#M29421</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2012-11-05T12:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means or other procedure for mean/quartiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105461#M29422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I see what you're saying. Does it matter where those missing ones are ranked? Could you set all missing values to the minimum value so that they are all put into the lowest quartile? Then at the 25%, 50%, etc. you will be at a point where you have that same % of the observations... just skewed up above their actual relative position when only compared to other non-missing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Nov 2012 13:52:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-or-other-procedure-for-mean-quartiles/m-p/105461#M29422</guid>
      <dc:creator>cau83</dc:creator>
      <dc:date>2012-11-05T13:52:07Z</dc:date>
    </item>
  </channel>
</rss>

