<?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: how can i revise this step? in SAS Software for Learning Community</title>
    <link>https://communities.sas.com/t5/SAS-Software-for-Learning/how-can-i-revise-this-step/m-p/907147#M1588</link>
    <description>&lt;P&gt;Your indentation is messed up.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By indenting the third step (the PROC) you make the code file look like you want to run the third step in the middle of the second step.&amp;nbsp; You have to finish one step before you can start running another.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So put the steps in the right order.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=work.boston_airbnb_listings nway;
    var price_numeric;
    output out=summary_stats
        p15= p15
        p25= p25
        mean= mean_reviews
    ;
run;

data work.boston_airbnb_ratings;
   set work.boston_airbnb_listings;
   if _n_=1 then set summary_stats;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now that you have the summary stats merged back onto the detailed records you can begin to use them together.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I don't think you are answering the question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You seem to be trying to subset to values between the 15th percentile and the 25th percentile. But they are asking for the TOP values.&amp;nbsp; Perhaps just the top 15% but perhaps as much as the top 25%.&amp;nbsp; Totally different subset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also do you have those other variables it mentions? Or do you need to calculate those also?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 09 Dec 2023 03:08:36 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-12-09T03:08:36Z</dc:date>
    <item>
      <title>how can i revise this step?</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/how-can-i-revise-this-step/m-p/903746#M1568</link>
      <description>&lt;DIV&gt;&lt;P&gt;The city counsel on Boston would like to limit the number of overpriced and under represented Airbnb listings in the Boston area. The new rules require that hosts own the properties they rent out, and live in them for at least nine months of the year every year as well as pay an annual licensing fee. Many have not paid their fees and the city needs to perform an audit. But with few auditors available they need to limit their search. The city would like to narrow the listings to how many higher priced listings, with lower reviews than average, and are available more than 90 days per year.&lt;/P&gt;&lt;P&gt;The Director housing of Boston would like to know if, the number of listings that are the top (approximately) 15%-25% of listings in terms of price, show fewer and lower reviews than average, and are available more than 90 days per year. What the average price, number of days available, ratings and number of ratings posted. This will be the initial target of their audit.&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;data boston_airbnb_listings;&lt;/DIV&gt;&lt;DIV&gt;set boston_airbnb_listings;&lt;/DIV&gt;&lt;DIV&gt;price_numeric = input(price, comma32.);&lt;/DIV&gt;&lt;DIV&gt;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;/* Data step to calculate percentiles and mean reviews and filter */&lt;/DIV&gt;&lt;DIV&gt;data work.boston_airbnb_ratings;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; set work.boston_airbnb_listings;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* Use PROC SUMMARY to calculate percentiles and mean */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; proc summary data=work.boston_airbnb_listings nway;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var price_numeric;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; output out=summary_stats&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p15= p15&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p25= p25&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mean= mean_reviews;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; run;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;end;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; /* Filter based on criteria: top 15%-25% of listings in terms of price, lower reviews, and available &amp;gt; 90 days */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; if price_numeric &amp;gt;= p15 and price_numeric &amp;lt;= p25 then output;&lt;/DIV&gt;&lt;DIV&gt;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;how can i revise this step?&lt;/DIV&gt;</description>
      <pubDate>Sat, 18 Nov 2023 01:07:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/how-can-i-revise-this-step/m-p/903746#M1568</guid>
      <dc:creator>112</dc:creator>
      <dc:date>2023-11-18T01:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: how can i revise this step?</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/how-can-i-revise-this-step/m-p/903893#M1569</link>
      <description>&lt;P&gt;Without digging into the detailed requirements, I would think first calculate the limits (e.g. in&amp;nbsp; you PROC SUMMERY), then join the result back to the detiail data to categorize the listings.&lt;/P&gt;
&lt;P&gt;Burt to get more tangible help, please provide sample input data in data step with DATALINES, and a sample desired output.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 12:06:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/how-can-i-revise-this-step/m-p/903893#M1569</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-11-20T12:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: how can i revise this step?</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/how-can-i-revise-this-step/m-p/903896#M1570</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/460121"&gt;@112&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;data &lt;FONT color="#FF6600"&gt;boston_airbnb_listings&lt;/FONT&gt;;&lt;/DIV&gt;
&lt;DIV&gt;set &lt;FONT color="#FF6600"&gt;boston_airbnb_listings&lt;/FONT&gt;;&lt;/DIV&gt;
&lt;DIV&gt;price_numeric = input(price, comma32.);&lt;/DIV&gt;
&lt;DIV&gt;run;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P class="1700482453343"&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It is almost always a bad idea to overwrite an existing dataset during development.&lt;/P&gt;
&lt;P&gt;Also note, that you can't embed a proc in a data step.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 12:15:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/how-can-i-revise-this-step/m-p/903896#M1570</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2023-11-20T12:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: how can i revise this step?</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/how-can-i-revise-this-step/m-p/907128#M1587</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I really like how this approach uses PROC UNIVARIATE to pre-calculate stats before merging, as preprocessing large datasets can improve efficiency. When working with merges like this, I always double check that the BY variables match and am specific about filtering with IF statements. Validation is also important - I like to check merged vs skipped row counts. For massive files, a JOIN may perform better than MERGE. Overall this gives a good starting template that I'd tweak the filters and UNIVARIATE options in based on my unique analysis needs. Nice work putting this code together - it provides a solid baseline to build from.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 22:43:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/how-can-i-revise-this-step/m-p/907128#M1587</guid>
      <dc:creator>Zinedine</dc:creator>
      <dc:date>2023-12-08T22:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: how can i revise this step?</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/how-can-i-revise-this-step/m-p/907147#M1588</link>
      <description>&lt;P&gt;Your indentation is messed up.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By indenting the third step (the PROC) you make the code file look like you want to run the third step in the middle of the second step.&amp;nbsp; You have to finish one step before you can start running another.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So put the steps in the right order.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=work.boston_airbnb_listings nway;
    var price_numeric;
    output out=summary_stats
        p15= p15
        p25= p25
        mean= mean_reviews
    ;
run;

data work.boston_airbnb_ratings;
   set work.boston_airbnb_listings;
   if _n_=1 then set summary_stats;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now that you have the summary stats merged back onto the detailed records you can begin to use them together.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I don't think you are answering the question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You seem to be trying to subset to values between the 15th percentile and the 25th percentile. But they are asking for the TOP values.&amp;nbsp; Perhaps just the top 15% but perhaps as much as the top 25%.&amp;nbsp; Totally different subset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also do you have those other variables it mentions? Or do you need to calculate those also?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2023 03:08:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/how-can-i-revise-this-step/m-p/907147#M1588</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-12-09T03:08:36Z</dc:date>
    </item>
  </channel>
</rss>

