<?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: finding percentage dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/finding-percentage-dataset/m-p/392839#M94572</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;You are right. However, questions of this kind makes me feel OP isn't completely sound with one pass of PDV construct. It may be little too intimidating to jump to DOW until one is thorough with traditional step by step process. One needs a little more time I think. Well, just my 2 cents.&lt;/P&gt;</description>
    <pubDate>Sun, 03 Sep 2017 03:41:50 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2017-09-03T03:41:50Z</dc:date>
    <item>
      <title>finding percentage dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-percentage-dataset/m-p/392806#M94560</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to find the percentage of sex by male and female &amp;nbsp;using datastep.. i can find using proc freq or proc sql but can one help me with base sas&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 230px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14800iFE6387E779242731/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want output like below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 386px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14801i4AE6572E4C5DC657/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Sep 2017 20:50:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-percentage-dataset/m-p/392806#M94560</guid>
      <dc:creator>shivamarrora0</dc:creator>
      <dc:date>2017-09-02T20:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: finding percentage dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-percentage-dataset/m-p/392807#M94561</link>
      <description>&lt;P&gt;Can you please show your attempt using proc sql&lt;/P&gt;</description>
      <pubDate>Sat, 02 Sep 2017 20:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-percentage-dataset/m-p/392807#M94561</guid>
      <dc:creator>MarkWik</dc:creator>
      <dc:date>2017-09-02T20:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: finding percentage dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-percentage-dataset/m-p/392814#M94563</link>
      <description>&lt;P&gt;Yep like&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/34445"&gt;@MarkWik&lt;/a&gt;&amp;nbsp;mentioned, it would be interesting to know&amp;nbsp;how you did by proc sql.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this how you did it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sql&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;select a.sex,count, count/c*&lt;STRONG&gt;100&lt;/STRONG&gt; as pct&lt;/P&gt;&lt;P&gt;from (select sex,count(sex) as count from sashelp.class group by sex) a,(select count(sex) as c from sashelp.class) ;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*datastep*/&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=sashelp.class out=have;&lt;/P&gt;&lt;P&gt;by sex;&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;data&lt;/STRONG&gt; want;&lt;/P&gt;&lt;P&gt;set have nobs=nobs;&lt;/P&gt;&lt;P&gt;by sex;&lt;/P&gt;&lt;P&gt;if first.sex then count=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;count+&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if last.sex then do;&lt;/P&gt;&lt;P&gt;pct=count/nobs*&lt;STRONG&gt;100&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Sep 2017 21:26:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-percentage-dataset/m-p/392814#M94563</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-09-02T21:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: finding percentage dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-percentage-dataset/m-p/392826#M94566</link>
      <description>&lt;P&gt;So you want the PROC FREQ output but not using PROC FREQ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DoW loops in a data step are the most efficient method for this, but I highly suspect this is homework so you should probably use a method that's in your class notes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What about PROC TABULATE?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this isn't homework and you're trying to find the most efficient method, here's a DoW loop tutorial&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings12/052-2012.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings12/052-2012.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Sep 2017 01:07:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-percentage-dataset/m-p/392826#M94566</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-03T01:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: finding percentage dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-percentage-dataset/m-p/392839#M94572</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;You are right. However, questions of this kind makes me feel OP isn't completely sound with one pass of PDV construct. It may be little too intimidating to jump to DOW until one is thorough with traditional step by step process. One needs a little more time I think. Well, just my 2 cents.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Sep 2017 03:41:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-percentage-dataset/m-p/392839#M94572</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-09-03T03:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: finding percentage dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-percentage-dataset/m-p/392895#M94595</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;I fully agree, but it would depend on if it was genuinely homework or not. Someone learning for general knowledge may want to go down that route, in comparison a students goal is to answer homework. Although I highly suspect it's homework I don't want to dissuade someone who is trying to learn. &amp;nbsp;Theoretically they should overlap but students don't usually have the time...&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2017 02:30:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-percentage-dataset/m-p/392895#M94595</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-04T02:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: finding percentage dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-percentage-dataset/m-p/393302#M94701</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/144247"&gt;@shivamarrora0&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to find the percentage of sex by male and female &amp;nbsp;using datastep.. i can find using proc freq or proc sql but can one help me with base sas&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Note that Proc SQL and Proc Freq are "base SAS".&lt;/P&gt;
&lt;P&gt;Datastep is for low level data manipulation most&amp;nbsp;often to create input into Proc Freq or other analysis or reporting procedure.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 16:51:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-percentage-dataset/m-p/393302#M94701</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-05T16:51:37Z</dc:date>
    </item>
  </channel>
</rss>

