<?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: Proq Freq help please in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Proq-Freq-help-please/m-p/342634#M10210</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/133949"&gt;@kcmitche&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I'm trying to create a table that will show all the team_names.&lt;/P&gt;
&lt;P&gt;then show how many Offensive rebounds they had (listed as 'O') in event_desc_id&lt;/P&gt;
&lt;P&gt;that happened directly before a 2FGA or TO&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does that make any sense?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Essentially I need to figure out how many time a team had an offensive rebound that was directly followed by a certain event. &amp;nbsp;(The certain event can change) and I'd like to give percentages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data inter;
set have;
if event_desc_id in ('2FGA','TO') and lag(event_desc_id) = 'O'
then output;
run;

proc freq data=inter;
table team_name;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Completely untested, for lack of data.&lt;/P&gt;</description>
    <pubDate>Mon, 20 Mar 2017 15:14:19 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-03-20T15:14:19Z</dc:date>
    <item>
      <title>Proq Freq help please</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Proq-Freq-help-please/m-p/342459#M10203</link>
      <description>&lt;P&gt;Evening,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;current code&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc import datafile="/home/kcmitche/Basketball Data.xlsx"&lt;BR /&gt;out=BB dbms=xlsx replace;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc freq data=BB;&lt;BR /&gt;tables team_name*event_desc_id / crosslist Missing nocum nopercent;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question:&lt;/P&gt;&lt;P&gt;When doing a cross tabulation how can i tell SAS to only count how many times a certain event happened in the (even_desc_id)?&lt;/P&gt;&lt;P&gt;I want to count how many times a specific variable happens rather than all of them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2nd question more advanced.&lt;/P&gt;&lt;P&gt;Is there a way to count how many times something happen (see above) based on what the row below in the data says?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 04:26:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Proq-Freq-help-please/m-p/342459#M10203</guid>
      <dc:creator>kcmitche</dc:creator>
      <dc:date>2017-03-20T04:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: Proq Freq help please</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Proq-Freq-help-please/m-p/342484#M10204</link>
      <description>&lt;P&gt;Use the macro provided in &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; to post an example of your dataset BB in datastep form, and an example what your expected output from proc freq should be.&lt;/P&gt;
&lt;P&gt;Do NOT post the Excel file, as it is useless (security, firewalls) in most cases.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A variable "happens" in every observation, so I guess you meant how often certain &lt;U&gt;values&lt;/U&gt; appear. This is what proc freq does.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your second question, the lag() function might be the answer. But we can help more with example data.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 07:35:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Proq-Freq-help-please/m-p/342484#M10204</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-20T07:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Proq Freq help please</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Proq-Freq-help-please/m-p/342606#M10206</link>
      <description>&lt;P&gt;I can't follow and understand how to create the data (from the link you provided)&lt;/P&gt;&lt;P&gt;I'm sorry I'm not as skilled in SAS as I'd like to be.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/7835i4620010D727206C2/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Screenshot of DATA" title="Screenshot of DATA" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe this screenshot will help with my data since you don't have to download anything.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 14:37:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Proq-Freq-help-please/m-p/342606#M10206</guid>
      <dc:creator>kcmitche</dc:creator>
      <dc:date>2017-03-20T14:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proq Freq help please</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Proq-Freq-help-please/m-p/342607#M10207</link>
      <description>&lt;P&gt;And what would the desired result from your posted example "data" be?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 14:40:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Proq-Freq-help-please/m-p/342607#M10207</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-03-20T14:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: Proq Freq help please</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Proq-Freq-help-please/m-p/342608#M10208</link>
      <description>&lt;P&gt;I'm trying to create a table that will show all the team_names.&lt;/P&gt;&lt;P&gt;then show how many Offensive rebounds they had (listed as 'O') in event_desc_id&lt;/P&gt;&lt;P&gt;that happened directly before a 2FGA or TO&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does that make any sense?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Essentially I need to figure out how many time a team had an offensive rebound that was directly followed by a certain event. &amp;nbsp;(The certain event can change) and I'd like to give percentages.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 14:43:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Proq-Freq-help-please/m-p/342608#M10208</guid>
      <dc:creator>kcmitche</dc:creator>
      <dc:date>2017-03-20T14:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: Proq Freq help please</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Proq-Freq-help-please/m-p/342629#M10209</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/133949"&gt;@kcmitche&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I can't follow and understand how to create the data (from the link you provided)&lt;/P&gt;
&lt;P&gt;I'm sorry I'm not as skilled in SAS as I'd like to be.&lt;/P&gt;
&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe this screenshot will help with my data since you don't have to download anything.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It's not rocket science, just very basic Base SAS usage. Before embarking on anything more complicated with SAS, you should already have developed the necessary SAS skills. Besides, the whole thing is very well documented, so even very novice users can handle it. That is the express purpose of the macro, it is designed to assist newcomers here in providing sample data for their questions.&lt;/P&gt;
&lt;P&gt;- download the .zip&lt;/P&gt;
&lt;P&gt;- unpack the .sas contained within&lt;/P&gt;
&lt;P&gt;- open in EG or Studio or SAS DMS editor (or open with any text editor and copy/paste from there into SAS)&lt;/P&gt;
&lt;P&gt;- run it. The macro will be compiled for your current SAS session&lt;/P&gt;
&lt;P&gt;Now you can use the macro to convert your dataset, as is described in the linked page.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 15:08:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Proq-Freq-help-please/m-p/342629#M10209</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-20T15:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proq Freq help please</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Proq-Freq-help-please/m-p/342634#M10210</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/133949"&gt;@kcmitche&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I'm trying to create a table that will show all the team_names.&lt;/P&gt;
&lt;P&gt;then show how many Offensive rebounds they had (listed as 'O') in event_desc_id&lt;/P&gt;
&lt;P&gt;that happened directly before a 2FGA or TO&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does that make any sense?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Essentially I need to figure out how many time a team had an offensive rebound that was directly followed by a certain event. &amp;nbsp;(The certain event can change) and I'd like to give percentages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data inter;
set have;
if event_desc_id in ('2FGA','TO') and lag(event_desc_id) = 'O'
then output;
run;

proc freq data=inter;
table team_name;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Completely untested, for lack of data.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 15:14:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Proq-Freq-help-please/m-p/342634#M10210</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-20T15:14:19Z</dc:date>
    </item>
  </channel>
</rss>

