<?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 find the frequency of two variables both occurring at the same time in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-frequency-of-two-variables-both-occurring-at-the/m-p/784437#M250332</link>
    <description>&lt;PRE&gt;&lt;CODE class=""&gt;title Repeat Trips;
proc freq data = divvytrips;
	tables from_station_id*to_station_id / list out=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/395678"&gt;@camryndastrup&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;I am working on a project that involves two separate CSV files. The first data set, "Trips" has seven columns, with a trip_id, bike_id, duration, from_station_id, to_station_id, capacity and usertype. User type is the only character values, the rest are numerical. The second csv file has station_id and station_name. I am trying to identify the number of observations that have the same from_station_id and to_station_id (frequency of repeated trips).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have tried to use proc freq, proc sort, and data DUPS, but have not been able to produce a table that shows the frequency of repeated trips. Below is the code that I have tried and I have attached the csv files with my data for reference. (DIvvyTrips is the file with from_station_id and to_station_id).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;title Repeat Trips;
proc freq data = divvytrips;
	tables from_station_id to_station_id;
run;

/*proc sort data = DivvyTrips nouniquekeys out=duplicates;
	by from_station_id to_station_id;
run; 

title "Repeated Trips";
proc print data = DivvyTrips;
run;

/*data DUPS;
	set DivvyTrips;
	by from_station_id to_station_id;
	if from_station_id and to_station_id then list;
	else output;
run;



title "Repeated Trips";
proc print data=DivvyTrips;
run;*/&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Dec 2021 01:53:53 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-12-07T01:53:53Z</dc:date>
    <item>
      <title>How to find the frequency of two variables both occurring at the same time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-frequency-of-two-variables-both-occurring-at-the/m-p/784435#M250331</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I am working on a project that involves two separate CSV files. The first data set, "Trips" has seven columns, with a trip_id, bike_id, duration, from_station_id, to_station_id, capacity and usertype. User type is the only character values, the rest are numerical. The second csv file has station_id and station_name. I am trying to identify the number of observations that have the same from_station_id and to_station_id (frequency of repeated trips).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have tried to use proc freq, proc sort, and data DUPS, but have not been able to produce a table that shows the frequency of repeated trips. Below is the code that I have tried and I have attached the csv files with my data for reference. (DIvvyTrips is the file with from_station_id and to_station_id).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;title Repeat Trips;
proc freq data = divvytrips;
	tables from_station_id to_station_id;
run;

/*proc sort data = DivvyTrips nouniquekeys out=duplicates;
	by from_station_id to_station_id;
run; 

title "Repeated Trips";
proc print data = DivvyTrips;
run;

/*data DUPS;
	set DivvyTrips;
	by from_station_id to_station_id;
	if from_station_id and to_station_id then list;
	else output;
run;



title "Repeated Trips";
proc print data=DivvyTrips;
run;*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Dec 2021 01:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-frequency-of-two-variables-both-occurring-at-the/m-p/784435#M250331</guid>
      <dc:creator>camryndastrup</dc:creator>
      <dc:date>2021-12-07T01:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the frequency of two variables both occurring at the same time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-frequency-of-two-variables-both-occurring-at-the/m-p/784437#M250332</link>
      <description>&lt;PRE&gt;&lt;CODE class=""&gt;title Repeat Trips;
proc freq data = divvytrips;
	tables from_station_id*to_station_id / list out=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/395678"&gt;@camryndastrup&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;I am working on a project that involves two separate CSV files. The first data set, "Trips" has seven columns, with a trip_id, bike_id, duration, from_station_id, to_station_id, capacity and usertype. User type is the only character values, the rest are numerical. The second csv file has station_id and station_name. I am trying to identify the number of observations that have the same from_station_id and to_station_id (frequency of repeated trips).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have tried to use proc freq, proc sort, and data DUPS, but have not been able to produce a table that shows the frequency of repeated trips. Below is the code that I have tried and I have attached the csv files with my data for reference. (DIvvyTrips is the file with from_station_id and to_station_id).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;title Repeat Trips;
proc freq data = divvytrips;
	tables from_station_id to_station_id;
run;

/*proc sort data = DivvyTrips nouniquekeys out=duplicates;
	by from_station_id to_station_id;
run; 

title "Repeated Trips";
proc print data = DivvyTrips;
run;

/*data DUPS;
	set DivvyTrips;
	by from_station_id to_station_id;
	if from_station_id and to_station_id then list;
	else output;
run;



title "Repeated Trips";
proc print data=DivvyTrips;
run;*/&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 01:53:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-frequency-of-two-variables-both-occurring-at-the/m-p/784437#M250332</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-12-07T01:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the frequency of two variables both occurring at the same time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-frequency-of-two-variables-both-occurring-at-the/m-p/784440#M250333</link>
      <description>&lt;P&gt;Thank you! How can I get that table to show only the recurring observations, and eliminate the observations that only occur once?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 02:07:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-frequency-of-two-variables-both-occurring-at-the/m-p/784440#M250333</guid>
      <dc:creator>camryndastrup</dc:creator>
      <dc:date>2021-12-07T02:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the frequency of two variables both occurring at the same time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-frequency-of-two-variables-both-occurring-at-the/m-p/784447#M250336</link>
      <description>&lt;P&gt;Add a filter to the output data set?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title Repeat Trips;
proc freq data = divvytrips noprint;
	tables from_station_id*to_station_id / list out=want (where=(count&amp;gt;1));
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/395678"&gt;@camryndastrup&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you! How can I get that table to show only the recurring observations, and eliminate the observations that only occur once?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 02:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-frequency-of-two-variables-both-occurring-at-the/m-p/784447#M250336</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-12-07T02:58:01Z</dc:date>
    </item>
  </channel>
</rss>

