<?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: Extracting and counting data from csv in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341377#M10153</link>
    <description>&lt;P&gt;i couldn't figure it out with the code you suggested. &amp;nbsp;Sorry i'm still new to sas.&lt;/P&gt;&lt;P&gt;All i did was import the data and then followed with what you wrote but clearly that wasn't correct.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Mar 2017 00:43:56 GMT</pubDate>
    <dc:creator>kcmitche</dc:creator>
    <dc:date>2017-03-16T00:43:56Z</dc:date>
    <item>
      <title>Extracting and counting data from csv</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341064#M10134</link>
      <description>&lt;P&gt;Good evening. I've got a question, obviously&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have a large data set (120k observation )&lt;/P&gt;&lt;P&gt;i need to find a way to count the number of times an event occurs after another ever&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;evrytime there is a rows in my data is labeled with "O" in a colum, I need to count how many time the row directly below equals "2FGA"&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;there is another column that represents a name with each row.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone knows how it would be possible to count how many time name associated with the "O" was counted would be great.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ask me questoins if im being too broad.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2017 04:18:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341064#M10134</guid>
      <dc:creator>kcmitche</dc:creator>
      <dc:date>2017-03-15T04:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting and counting data from csv</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341068#M10136</link>
      <description>&lt;P&gt;Not sure if I understand what you have but, hopefully, the following comes close:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
  length event $4;
  set sashelp.class (keep=name);
  if _n_ in (2,4,6,8,10,12,14,16,18) then event='O';
  if _n_ in (3,7,11,13,17,19) then event='2FGA';
run;

data want (drop=last);
  set have;
  last=lag(event);
  if event='2FGA' and last eq 'O' then output;
run;
&lt;/PRE&gt;
&lt;P&gt;The resulting file, want, has 6 records which is the count I think you are looking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2017 04:31:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341068#M10136</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-15T04:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting and counting data from csv</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341374#M10151</link>
      <description>&lt;P&gt;I'll give it a try but to try and make myself more clear&amp;nbsp;i'm attaching an example of the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So you'll see 5 columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1st (no title) / 2nd (team_name) / 3rd (player_name) / 4th (event_desc_id) / 5th (event_desc)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so basically there will be values in the 'event_desc_id' column such as 2FGAB, AG, FV, D, O, 3FGA, 2FGA&lt;/P&gt;&lt;P&gt;I would like to count the number of times that the row directly after an 'O' has a '3FGA' or a 2FGA'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hopefully that will make a bit more sense&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 00:38:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341374#M10151</guid>
      <dc:creator>kcmitche</dc:creator>
      <dc:date>2017-03-16T00:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting and counting data from csv</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341375#M10152</link>
      <description>&lt;P&gt;Did you try the method I suggested? To repeat, :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want (drop=last);
  set have;
  last=lag(event);
  if event in ('2FGA','3FGA') and last eq 'O' then output;
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Mar 2017 00:43:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341375#M10152</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-16T00:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting and counting data from csv</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341377#M10153</link>
      <description>&lt;P&gt;i couldn't figure it out with the code you suggested. &amp;nbsp;Sorry i'm still new to sas.&lt;/P&gt;&lt;P&gt;All i did was import the data and then followed with what you wrote but clearly that wasn't correct.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 00:43:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341377#M10153</guid>
      <dc:creator>kcmitche</dc:creator>
      <dc:date>2017-03-16T00:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting and counting data from csv</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341378#M10154</link>
      <description>&lt;P&gt;When I run the results nothing pops up it does straight to the output tab&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 00:45:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341378#M10154</guid>
      <dc:creator>kcmitche</dc:creator>
      <dc:date>2017-03-16T00:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting and counting data from csv</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341379#M10155</link>
      <description>&lt;P&gt;post the code you ran&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 00:46:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341379#M10155</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-16T00:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting and counting data from csv</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341380#M10156</link>
      <description>&lt;P&gt;so far this is all i have.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc import datafile="/home/kcmitche/DataChallengeEuroGamePBP-2.csv"&lt;BR /&gt;out=EuroBB dbms=csv replace;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data want (drop=last);&lt;BR /&gt;set have;&lt;BR /&gt;last=lag(event);&lt;BR /&gt;if event in ('2FGA','3FGA') and last eq 'O' then output;&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;again rookie here&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 00:47:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341380#M10156</guid>
      <dc:creator>kcmitche</dc:creator>
      <dc:date>2017-03-16T00:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting and counting data from csv</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341381#M10157</link>
      <description>&lt;P&gt;And, can you view file WANT? If I correctly understand what you wanted, the number of records in that file is the answer you were seeking.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 00:49:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341381#M10157</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-16T00:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting and counting data from csv</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341382#M10158</link>
      <description>&lt;P&gt;So I'm trying to count the number of times that a selected variables happen directly after an 'O'. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example in the&amp;nbsp;sample data.&lt;/P&gt;&lt;P&gt;row 25 has 'O' and directly below that row 26 has a '2FGA'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to find a way to show how many times that the player_name associated with an 'O' resulted in a 2FGA or 3FGA directly after the 'O'. &amp;nbsp;I don't care about the player_name in the following row or in the row with 'O'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try and explain differently&lt;/P&gt;&lt;P&gt;in row 25.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Honeycutt, Tyler = 1 'O' (because directly after there was a 2FGA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;next would be&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rice, Tyrese (row 29)&lt;/P&gt;&lt;P&gt;he would = 1 because there was a 3FGM after.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;does that make more sense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 00:57:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341382#M10158</guid>
      <dc:creator>kcmitche</dc:creator>
      <dc:date>2017-03-16T00:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting and counting data from csv</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341384#M10159</link>
      <description>&lt;P&gt;I'd like to make a table showing me how many times this happened to each player.&lt;/P&gt;&lt;P&gt;'O' stands for offensive rebounds.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically i would like to find a way to find the top 5 players whose offensive rebounds resulted in an attempted shot on the basket&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 00:58:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Extracting-and-counting-data-from-csv/m-p/341384#M10159</guid>
      <dc:creator>kcmitche</dc:creator>
      <dc:date>2017-03-16T00:58:39Z</dc:date>
    </item>
  </channel>
</rss>

