<?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: Not able to get the mean of the selected observations in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-get-the-mean-of-the-selected-observations/m-p/847866#M36983</link>
    <description>&lt;P&gt;Also, I point out that your SQL will produce the wrong answer in the presence of missing values, better to use PROC MEANS to compute N as I showed.&lt;/P&gt;</description>
    <pubDate>Mon, 05 Dec 2022 18:04:41 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-12-05T18:04:41Z</dc:date>
    <item>
      <title>Not able to get the mean of the selected observations</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-get-the-mean-of-the-selected-observations/m-p/847842#M36976</link>
      <description>&lt;P&gt;This project will use the data set sashelp.shoes. Write a SAS program that will: • Read sashelp.shoes as input. • Create a new SAS data set, work.shoerange. • Create a new character variable SalesRange that will be used to categorize the observations into three groups. • Set the value of SalesRange to the following: o Lower when Sales are less than $100,000. o Middle when Sales are between $100,000 and $200,000, inclusively. o Upper when Sales are above $200,000. Run the program, then use additional SAS procedures to answer the following questions: Question 3: How many observations are classified into the “Lower” group? Question 4: What is the mean value of the Sales variable for observations in the “Middle” group? Round your answer to the nearest whole number.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not able to get the mean in the second question&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 17:15:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Not-able-to-get-the-mean-of-the-selected-observations/m-p/847842#M36976</guid>
      <dc:creator>AnkitaSingh_901</dc:creator>
      <dc:date>2022-12-05T17:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to get the mean of the selected observations</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-get-the-mean-of-the-selected-observations/m-p/847844#M36977</link>
      <description>&lt;P&gt;Have you created work.shoerange successfully?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please show your code for creating that dataset, your code for answering the first question, and the code you have tried for answering the second question.&amp;nbsp; That will help people help you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The good news is your class is using sashelp.shoes as input, so if you post your code, everyone will be able to run it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, please describe whether your are struggling with error messages (pleas include them) or incorrect results (please describe how they are incorrect)&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 17:21:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Not-able-to-get-the-mean-of-the-selected-observations/m-p/847844#M36977</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-12-05T17:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to get the mean of the selected observations</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-get-the-mean-of-the-selected-observations/m-p/847850#M36978</link>
      <description>&lt;P&gt;This is my entire code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data shoerange;&lt;BR /&gt;set sashelp.shoes;&lt;BR /&gt;length salesrange $8;&lt;BR /&gt;if sales lt 100000 then salesrange = "lower";&lt;BR /&gt;if 100000 gt sales lt 200000 then salesrange = "middle";&lt;BR /&gt;if sales gt 200000 then salesrange = "upper";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select count(*)&lt;BR /&gt;from work.shoerange&lt;BR /&gt;where salesrange = "lower";&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;proc means data= shoerange mean;&lt;BR /&gt;by sales;&lt;BR /&gt;where salesrange = "middle";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 17:42:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Not-able-to-get-the-mean-of-the-selected-observations/m-p/847850#M36978</guid>
      <dc:creator>AnkitaSingh_901</dc:creator>
      <dc:date>2022-12-05T17:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to get the mean of the selected observations</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-get-the-mean-of-the-selected-observations/m-p/847860#M36980</link>
      <description>&lt;P&gt;The first step in debugging this is a step that you should be doing. That is, look at the data in data set SHOERANGE and see if it has been created properly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the data in data set SHOERANGE&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PaigeMiller_0-1670262813926.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78044iD4926736F17725F6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PaigeMiller_0-1670262813926.png" alt="PaigeMiller_0-1670262813926.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this correct? Should row 1 have salesrange = 'middle'? If not, then look at your code and figure out what you did wrong that wound up giving row 1 a sales range of 'middle' instead of 'lower'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, once you fix that, I suggest that instead of using SQL and then PROC MEANS, you just use PROC MEANS, which is less typing than using both SQL and PROC MEANS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=shoerange n mean;
class salesrange;
var sales;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 18:04:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Not-able-to-get-the-mean-of-the-selected-observations/m-p/847860#M36980</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-05T18:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to get the mean of the selected observations</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-get-the-mean-of-the-selected-observations/m-p/847861#M36981</link>
      <description>&lt;P&gt;Yes, But i am not able to debug... Kindly help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 18:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Not-able-to-get-the-mean-of-the-selected-observations/m-p/847861#M36981</guid>
      <dc:creator>AnkitaSingh_901</dc:creator>
      <dc:date>2022-12-05T18:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to get the mean of the selected observations</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-get-the-mean-of-the-selected-observations/m-p/847864#M36982</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if 100000 gt sales lt 200000 then salesrange = "middle";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The first part &lt;FONT face="courier new,courier"&gt;100000 gt sales&lt;/FONT&gt; is the same as sales&amp;lt;100000, that doesn't seem to be what you want. What should it say to have values between 100000 and 200000 in the "middle" category?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 18:05:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Not-able-to-get-the-mean-of-the-selected-observations/m-p/847864#M36982</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-05T18:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to get the mean of the selected observations</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-get-the-mean-of-the-selected-observations/m-p/847866#M36983</link>
      <description>&lt;P&gt;Also, I point out that your SQL will produce the wrong answer in the presence of missing values, better to use PROC MEANS to compute N as I showed.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 18:04:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Not-able-to-get-the-mean-of-the-selected-observations/m-p/847866#M36983</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-05T18:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to get the mean of the selected observations</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Not-able-to-get-the-mean-of-the-selected-observations/m-p/847868#M36984</link>
      <description>&lt;P&gt;Thanks a ton. The solution worked..&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 18:11:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Not-able-to-get-the-mean-of-the-selected-observations/m-p/847868#M36984</guid>
      <dc:creator>AnkitaSingh_901</dc:creator>
      <dc:date>2022-12-05T18:11:47Z</dc:date>
    </item>
  </channel>
</rss>

