<?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 Replicate Confidence intervals of mean from Stata in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Replicate-Confidence-intervals-of-mean-from-Stata/m-p/613422#M18413</link>
    <description>&lt;P&gt;Dear Community.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new in SAS and loosing my mind with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA TEST;&lt;BR /&gt;INPUT ID UB CONS WGT;&lt;BR /&gt;CARDS;&lt;BR /&gt;1 0 23 12&lt;BR /&gt;2 0 13 10&lt;BR /&gt;3 0 21 20&lt;BR /&gt;4 0 20 13&lt;BR /&gt;5 1 19 12&lt;BR /&gt;6 1 24 14&lt;BR /&gt;7 0 26 16&lt;BR /&gt;8 0 17 10&lt;BR /&gt;9 0 19 19&lt;BR /&gt;10 1 22 17&lt;BR /&gt;11 0 27 10&lt;BR /&gt;12 0 18 12&lt;BR /&gt;13 1 22 13&lt;BR /&gt;14 1 21 20&lt;BR /&gt;15 1 20 16&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;UB: is a dummy for whether one consumes a given beer or not&lt;/LI&gt;&lt;LI&gt;CONS: is the reported number of bottle drank for a given period of time&lt;/LI&gt;&lt;LI&gt;WGT is my sampling adjustment weight.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data is from an online survey (no design), yet each respondent has a sampling adjustment weight to match the general population.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to estimate the mean consumption of beer and the corresponding 95% C.I for the two groups of UB (0,1) and test whether consumption is equal between the two groups.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Initially I ran this analysis in Stata and now I am tried to replicate it in SAS. I got the same weighted mean but different 95% C.I.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;STATA Codes: Since STATA does not allow for weighted t-test, I ran a mean estimation (accounting for weight) and used &lt;EM&gt;test&lt;/EM&gt; after mean estimation to compare the two means.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;. mean CONS [pweight=WGT]&lt;/SPAN&gt;, over(UB)&lt;/P&gt;&lt;P&gt;. test&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;[CONS]0=[CONS]1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;. test&lt;/TD&gt;&lt;TD&gt;[CONS]0=[CONS]1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;( 1)&lt;/TD&gt;&lt;TD&gt;[CONS]0 - [CONS]1&lt;/TD&gt;&lt;TD&gt;= 0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;F( 1, 14) =&lt;/TD&gt;&lt;TD&gt;0.26&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Prob &amp;gt; F =&lt;/TD&gt;&lt;TD&gt;0.6202&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In SAS, I am getting the same means but different 95% Confidence intervals.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Analysis Variable : CONS &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;UB&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;N Obs&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Mean&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Lower 95%&lt;BR /&gt;CL for Mean&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Upper 95%&lt;BR /&gt;CL for Mean&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;9&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;20.6475410&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;17.5247509&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;23.7703311&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;6&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;21.3478261&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;19.6156577&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;23.0799944&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can some body help with this?&lt;/P&gt;</description>
    <pubDate>Sun, 22 Dec 2019 03:07:42 GMT</pubDate>
    <dc:creator>nelngams</dc:creator>
    <dc:date>2019-12-22T03:07:42Z</dc:date>
    <item>
      <title>Replicate Confidence intervals of mean from Stata</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Replicate-Confidence-intervals-of-mean-from-Stata/m-p/613422#M18413</link>
      <description>&lt;P&gt;Dear Community.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new in SAS and loosing my mind with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA TEST;&lt;BR /&gt;INPUT ID UB CONS WGT;&lt;BR /&gt;CARDS;&lt;BR /&gt;1 0 23 12&lt;BR /&gt;2 0 13 10&lt;BR /&gt;3 0 21 20&lt;BR /&gt;4 0 20 13&lt;BR /&gt;5 1 19 12&lt;BR /&gt;6 1 24 14&lt;BR /&gt;7 0 26 16&lt;BR /&gt;8 0 17 10&lt;BR /&gt;9 0 19 19&lt;BR /&gt;10 1 22 17&lt;BR /&gt;11 0 27 10&lt;BR /&gt;12 0 18 12&lt;BR /&gt;13 1 22 13&lt;BR /&gt;14 1 21 20&lt;BR /&gt;15 1 20 16&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;UB: is a dummy for whether one consumes a given beer or not&lt;/LI&gt;&lt;LI&gt;CONS: is the reported number of bottle drank for a given period of time&lt;/LI&gt;&lt;LI&gt;WGT is my sampling adjustment weight.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data is from an online survey (no design), yet each respondent has a sampling adjustment weight to match the general population.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to estimate the mean consumption of beer and the corresponding 95% C.I for the two groups of UB (0,1) and test whether consumption is equal between the two groups.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Initially I ran this analysis in Stata and now I am tried to replicate it in SAS. I got the same weighted mean but different 95% C.I.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;STATA Codes: Since STATA does not allow for weighted t-test, I ran a mean estimation (accounting for weight) and used &lt;EM&gt;test&lt;/EM&gt; after mean estimation to compare the two means.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;. mean CONS [pweight=WGT]&lt;/SPAN&gt;, over(UB)&lt;/P&gt;&lt;P&gt;. test&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;[CONS]0=[CONS]1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;. test&lt;/TD&gt;&lt;TD&gt;[CONS]0=[CONS]1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;( 1)&lt;/TD&gt;&lt;TD&gt;[CONS]0 - [CONS]1&lt;/TD&gt;&lt;TD&gt;= 0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;F( 1, 14) =&lt;/TD&gt;&lt;TD&gt;0.26&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Prob &amp;gt; F =&lt;/TD&gt;&lt;TD&gt;0.6202&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In SAS, I am getting the same means but different 95% Confidence intervals.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Analysis Variable : CONS &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;UB&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;N Obs&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Mean&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Lower 95%&lt;BR /&gt;CL for Mean&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Upper 95%&lt;BR /&gt;CL for Mean&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;9&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;20.6475410&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;17.5247509&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;23.7703311&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;6&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;21.3478261&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;19.6156577&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;23.0799944&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can some body help with this?&lt;/P&gt;</description>
      <pubDate>Sun, 22 Dec 2019 03:07:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Replicate-Confidence-intervals-of-mean-from-Stata/m-p/613422#M18413</guid>
      <dc:creator>nelngams</dc:creator>
      <dc:date>2019-12-22T03:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate Confidence intervals of mean from Stata</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Replicate-Confidence-intervals-of-mean-from-Stata/m-p/613449#M18417</link>
      <description>&lt;P&gt;What SAS code did you use? That looks like PROC MEANS output. I suggest you use PROC SURVEYMEANS (if you want to correct for the survey nature) or PROC TTEST.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC TTEST with a WEIGHT WGT statement gives the same output, but also provides statistical tests for the difference of the means between the two groups. From the data, I would not assume that the variances are equal, which suggests using the Satterthwaite test results. The test statistic and p-value are close to the stata estimate you constructed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Dec 2019 19:10:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Replicate-Confidence-intervals-of-mean-from-Stata/m-p/613449#M18417</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-12-22T19:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate Confidence intervals of mean from Stata</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Replicate-Confidence-intervals-of-mean-from-Stata/m-p/613450#M18418</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=have;
    class ub;
    var cons;
    weight wgt;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;By the way, there's no reason to expect SAS and STATA will produce the exact same results, although it certainly is possible in this example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers to UB (University at Buffalo) for winning their first ever NCAA Football Bowl Game!&lt;/P&gt;</description>
      <pubDate>Sun, 22 Dec 2019 20:29:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Replicate-Confidence-intervals-of-mean-from-Stata/m-p/613450#M18418</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-12-22T20:29:16Z</dc:date>
    </item>
  </channel>
</rss>

