<?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 to count obs in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-count-obs/m-p/132768#M36127</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you don`t want to mention the numbers like (1,2,3) you can write the code as follow, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data want;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;set have;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;by product;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;if first.product then n = 0;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;n+1;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;if n &amp;lt; 4 then output;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;drop n;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Sep 2013 09:54:10 GMT</pubDate>
    <dc:creator>yaswanthj</dc:creator>
    <dc:date>2013-09-10T09:54:10Z</dc:date>
    <item>
      <title>How to count obs</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-count-obs/m-p/132763#M36122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to count observations using data set? I explain.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my table "have", there are 15 observation with duplicated values (by transaction and product)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to get a sample (only 3 observation) per product.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to do that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Sep 2013 00:00:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-count-obs/m-p/132763#M36122</guid>
      <dc:creator>Augusto</dc:creator>
      <dc:date>2013-09-10T00:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to count obs</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-count-obs/m-p/132764#M36123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please provide a sample of the data you are working with and an example of the desired output.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Sep 2013 02:39:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-count-obs/m-p/132764#M36123</guid>
      <dc:creator>Scott_Mitchell</dc:creator>
      <dc:date>2013-09-10T02:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to count obs</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-count-obs/m-p/132765#M36124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Scott, thanks..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in my table i have&lt;/P&gt;&lt;P&gt;id&amp;nbsp; financed product &lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 123,67&amp;nbsp;&amp;nbsp; car&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 145,90&amp;nbsp;&amp;nbsp; car&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 1214,00&amp;nbsp; bike&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 1234,00&amp;nbsp; car&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 15&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;34,00&amp;nbsp; bike&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 1094,00&amp;nbsp; car&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 1834,00&amp;nbsp; bike&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 9834,00&amp;nbsp; bike&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 1954,00&amp;nbsp; car&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 9886,00&amp;nbsp; bike&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;want&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 123,67&amp;nbsp;&amp;nbsp; car&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 145,90&amp;nbsp;&amp;nbsp; car&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 1234,00&amp;nbsp; car&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 1214,00&amp;nbsp; bike&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 15&lt;SPAN style="font-size: 10pt;"&gt;34,00&amp;nbsp; bike&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;1&amp;nbsp; 1834,00&amp;nbsp; bike&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;so i need only 3 observation per product&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Sep 2013 03:23:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-count-obs/m-p/132765#M36124</guid>
      <dc:creator>Augusto</dc:creator>
      <dc:date>2013-09-10T03:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to count obs</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-count-obs/m-p/132766#M36125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Augusto,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How about PROC SURVEYSELECT?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA HAVE;&lt;/P&gt;&lt;P&gt;INFILE DATALINES DLM=',';&lt;/P&gt;&lt;P&gt;INPUT ID FINANCED PRODUCT $;&lt;/P&gt;&lt;P&gt;DATALINES;&lt;/P&gt;&lt;P&gt;1,123.67,CAR&lt;/P&gt;&lt;P&gt;1,145.90,CAR&lt;/P&gt;&lt;P&gt;1,1214.00,BIKE&lt;/P&gt;&lt;P&gt;1,1234.00,CAR&lt;/P&gt;&lt;P&gt;1,1534.00,BIKE&lt;/P&gt;&lt;P&gt;1,1094.00,CAR&lt;/P&gt;&lt;P&gt;1,1834.00,BIKE&lt;/P&gt;&lt;P&gt;1,9834.00,BIKE&lt;/P&gt;&lt;P&gt;1,1954.00,CAR&lt;/P&gt;&lt;P&gt;1,9886.00,BIKE&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SORT DATA=HAVE;&lt;/P&gt;&lt;P&gt;BY PRODUCT;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SURVEYSELECT DATA=HAVE SAMPSIZE=3 OUT=WANT SEED=0;&lt;/P&gt;&lt;P&gt;STRATA PRODUCT;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Sep 2013 04:15:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-count-obs/m-p/132766#M36125</guid>
      <dc:creator>Scott_Mitchell</dc:creator>
      <dc:date>2013-09-10T04:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to count obs</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-count-obs/m-p/132767#M36126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can simply do using datastep.. as below..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA HAVE;&lt;/P&gt;&lt;P&gt;INFILE DATALINES DLM=',';&lt;/P&gt;&lt;P&gt;INPUT ID FINANCED PRODUCT $;&lt;/P&gt;&lt;P&gt;DATALINES;&lt;/P&gt;&lt;P&gt;1,123.67,CAR&lt;/P&gt;&lt;P&gt;1,145.90,CAR&lt;/P&gt;&lt;P&gt;1,1214.00,BIKE&lt;/P&gt;&lt;P&gt;1,1234.00,CAR&lt;/P&gt;&lt;P&gt;1,1534.00,BIKE&lt;/P&gt;&lt;P&gt;1,1094.00,CAR&lt;/P&gt;&lt;P&gt;1,1834.00,BIKE&lt;/P&gt;&lt;P&gt;1,9834.00,BIKE&lt;/P&gt;&lt;P&gt;1,1954.00,CAR&lt;/P&gt;&lt;P&gt;1,9886.00,BIKE&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SORT DATA=HAVE;&lt;/P&gt;&lt;P&gt;BY PRODUCT;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;by product;&lt;/P&gt;&lt;P&gt;if first.product then n = 0;&lt;/P&gt;&lt;P&gt;n+1;&lt;/P&gt;&lt;P&gt;if n in (1, 2, 3) then output;&lt;/P&gt;&lt;P&gt;drop n;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any questions ? ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;yaswanth J.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Sep 2013 09:12:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-count-obs/m-p/132767#M36126</guid>
      <dc:creator>yaswanthj</dc:creator>
      <dc:date>2013-09-10T09:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to count obs</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-count-obs/m-p/132768#M36127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you don`t want to mention the numbers like (1,2,3) you can write the code as follow, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data want;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;set have;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;by product;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;if first.product then n = 0;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;n+1;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;if n &amp;lt; 4 then output;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;drop n;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Sep 2013 09:54:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-count-obs/m-p/132768#M36127</guid>
      <dc:creator>yaswanthj</dc:creator>
      <dc:date>2013-09-10T09:54:10Z</dc:date>
    </item>
  </channel>
</rss>

