<?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 Unclear proc mean code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/507932#M136362</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to write a proc mean code to display only women who are married in my data-set.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The variable name is Marital_Status coded as&amp;nbsp; (1=Married, 0 = not married)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My SAS code is:&lt;/P&gt;&lt;P&gt;proc means data = hattis7 missing mean std sum nway;&lt;BR /&gt;var stratus weightus;&lt;BR /&gt;class Marital_Status;&lt;BR /&gt;output out = Martial_Status;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem i have is that when i run this code, it gives me a summary statistics for both 1 (Married) and 0 (not married).&lt;/P&gt;&lt;P&gt;How do i get an output that give me a summary statistic for ONLY people who are married (1).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Sat, 27 Oct 2018 02:31:17 GMT</pubDate>
    <dc:creator>ChuksManuel</dc:creator>
    <dc:date>2018-10-27T02:31:17Z</dc:date>
    <item>
      <title>Unclear proc mean code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/507932#M136362</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to write a proc mean code to display only women who are married in my data-set.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The variable name is Marital_Status coded as&amp;nbsp; (1=Married, 0 = not married)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My SAS code is:&lt;/P&gt;&lt;P&gt;proc means data = hattis7 missing mean std sum nway;&lt;BR /&gt;var stratus weightus;&lt;BR /&gt;class Marital_Status;&lt;BR /&gt;output out = Martial_Status;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem i have is that when i run this code, it gives me a summary statistics for both 1 (Married) and 0 (not married).&lt;/P&gt;&lt;P&gt;How do i get an output that give me a summary statistic for ONLY people who are married (1).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 27 Oct 2018 02:31:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/507932#M136362</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2018-10-27T02:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Unclear proc mean code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/507936#M136363</link>
      <description>&lt;P&gt;You would replace the CLASS statement with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where Marital_Status=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, is this a Freudian slip?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output out = Martial_Status;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may need to add to the OUTPUT statement.&amp;nbsp; Statistics requested on the PROC statement (mean std sum) apply to the printed report only.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, does your entire DATA step contain women only?&amp;nbsp; You might need to add something to the logic such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where Marital_Status=1 and gender="F";&lt;/P&gt;</description>
      <pubDate>Sat, 27 Oct 2018 02:42:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/507936#M136363</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-10-27T02:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Unclear proc mean code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/507937#M136364</link>
      <description>&lt;P&gt;You can add a WHERE statement, but you're filtering on two variables here, not just one.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means ....;
where marital_status=1 and sex = 'F';
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The exact code will depend on how the sex is recorded in your data and what the values hold.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/236266"&gt;@ChuksManuel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to write a proc mean code to display only women who are married in my data-set.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The variable name is Marital_Status coded as&amp;nbsp; (1=Married, 0 = not married)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My SAS code is:&lt;/P&gt;
&lt;P&gt;proc means data = hattis7 missing mean std sum nway;&lt;BR /&gt;var stratus weightus;&lt;BR /&gt;class Marital_Status;&lt;BR /&gt;output out = Martial_Status;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem i have is that when i run this code, it gives me a summary statistics for both 1 (Married) and 0 (not married).&lt;/P&gt;
&lt;P&gt;How do i get an output that give me a summary statistic for ONLY people who are married (1).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Oct 2018 02:39:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/507937#M136364</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-27T02:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: Unclear proc mean code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/507938#M136365</link>
      <description>&lt;P&gt;Thank you. They are all F&lt;/P&gt;</description>
      <pubDate>Sat, 27 Oct 2018 02:44:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/507938#M136365</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2018-10-27T02:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Unclear proc mean code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/507946#M136367</link>
      <description>&lt;P&gt;Hey Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to ask you one more question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;I wanted to write a SAS code&amp;nbsp; using proc means to create just one dataset that contains the minimum, maximum and median for the variables "weight" and "height" and i want to calculate these statistics for each unique combination of "Race" and "smok_status".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please how do i go about this if i want to use the "noprint" option to suppress the output to the Output window.&lt;/P&gt;</description>
      <pubDate>Sat, 27 Oct 2018 04:45:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/507946#M136367</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2018-10-27T04:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: Unclear proc mean code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/507974#M136382</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/236266"&gt;@ChuksManuel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hey Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanted to ask you one more question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I wanted to write a SAS code&amp;nbsp; using proc means to create just one dataset that contains the minimum, maximum and median for the variables "weight" and "height" and i want to calculate these statistics for each unique combination of "Race" and "smok_status".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please how do i go about this if i want to use the "noprint" option to suppress the output to the Output window.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have nway;
    class race smok_status;
    var weight height;
    output out=stats min= max= median= /autoname;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 27 Oct 2018 11:15:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/507974#M136382</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-10-27T11:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Unclear proc mean code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/508078#M136398</link>
      <description>&lt;P&gt;Thank you Paige. Please help me critique this code.&lt;/P&gt;&lt;P&gt;1. I want to calculate the average of baby's weight for each group defined by level of smoking status by marital status.&lt;/P&gt;&lt;P&gt;2. Then calculate the difference between the individual baby's weight and the average weight for the babies in the group defined by mother's smoking status and marital status.&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Exclude observations with missing data on the relevant variables from the calculations.&amp;nbsp;&lt;/P&gt;&lt;P&gt;4. Use Proc Means to find the average weight for babies in each condition and then do a merge so the values are available to find the difference for individual babies.&amp;nbsp;&lt;/P&gt;&lt;P&gt;5. Finally what do i do with the _TYPE_ variable?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Proc&lt;/STRONG&gt; &lt;STRONG&gt;means&lt;/STRONG&gt; data = work.data1 mean;&lt;/P&gt;&lt;P&gt;class momsmoke married;&lt;/P&gt;&lt;P&gt;var weight;&lt;/P&gt;&lt;P&gt;output out = group_mean (where = (_type_ =&lt;STRONG&gt;3&lt;/STRONG&gt;))&lt;/P&gt;&lt;P&gt;mean (weight) = mean_wt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sort&lt;/STRONG&gt; data = group_mean out=gm;&lt;/P&gt;&lt;P&gt;by momsmoke married;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sort&lt;/STRONG&gt; data = sashelp.bweight out=Indwt;&lt;/P&gt;&lt;P&gt;by momsmoke married;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt; gmIndwt;&lt;/P&gt;&lt;P&gt;merge gm Indwt;&lt;/P&gt;&lt;P&gt;by momsmoke married;&lt;/P&gt;&lt;P&gt;wt_diff= weight - mean_wt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;print&lt;/STRONG&gt; data = gmindwt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Oct 2018 03:11:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/508078#M136398</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2018-10-28T03:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Unclear proc mean code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/508100#M136414</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/236266"&gt;@ChuksManuel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you Paige. Please help me critique this code.&lt;/P&gt;
&lt;P&gt;1. I want to calculate the average of baby's weight for each group defined by level of smoking status by marital status.&lt;/P&gt;
&lt;P&gt;2. Then calculate the difference between the individual baby's weight and the average weight for the babies in the group defined by mother's smoking status and marital status.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. Exclude observations with missing data on the relevant variables from the calculations.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. Use Proc Means to find the average weight for babies in each condition and then do a merge so the values are available to find the difference for individual babies.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5. Finally what do i do with the _TYPE_ variable?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For steps 1 and 2:&lt;/P&gt;
&lt;P&gt;Use PROC STDIZE with METHOD=MEAN and a BY statement. This will subtract the mean of the values in each group from the actual values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 3: This is also done by PROC STDIZE, observations with a missing value of weight will remain missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 4: I'm lost, how does this differ from steps 1 and 2?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 5: You can do whatever you want with the _TYPE_ variable.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Oct 2018 10:53:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/508100#M136414</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-10-28T10:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Unclear proc mean code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/508181#M136443</link>
      <description>&lt;P&gt;Thank you Paige&lt;/P&gt;</description>
      <pubDate>Sun, 28 Oct 2018 21:56:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unclear-proc-mean-code/m-p/508181#M136443</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2018-10-28T21:56:24Z</dc:date>
    </item>
  </channel>
</rss>

