<?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 How do I determine surgeon volume in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-determine-surgeon-volume/m-p/760481#M37073</link>
    <description>&lt;P&gt;I want to calculate surgeon volume before 365 days of an index operation on a subject.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have records for a service user, service date and surgeon ID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data WORK.docs_have(label='Surgery Data');
    input  rcpt_id:32. service_date:date9. physician_id:32.;
   format service_date date9.;
 datalines;
 1356 22NOV2008 3354 
 1123 13OCT2010 3354 
 1267 18JAN2011 3354 
 1123 15AUG2011 3354 
 1145 30NOV2009 2234 
 1323 24JAN2010 2234 
 1122 29JAN2010 2234 
 1122 13SEP2010 2234 
 ;;;;&lt;/PRE&gt;&lt;P&gt;and I want Output like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; data WORK.docs_want(label='Surgery Data_want');
    input  rcpt_id:32. service_date:date9. physician_id:32. surg_vol:12;
   format service_date date9.;
 datalines;
 1356 22NOV2008 3354 0
 1123 13OCT2010 3354 0
 1267 18JAN2011 3354 1
 1123 15AUG2011 3354 2
 1145 30NOV2009 2234 0
 1323 24JAN2010 2234 1
 1122 29JAN2010 2234 2
  ;;;;&lt;/PRE&gt;</description>
    <pubDate>Mon, 09 Aug 2021 21:44:20 GMT</pubDate>
    <dc:creator>yubaraj</dc:creator>
    <dc:date>2021-08-09T21:44:20Z</dc:date>
    <item>
      <title>How do I determine surgeon volume</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-determine-surgeon-volume/m-p/760481#M37073</link>
      <description>&lt;P&gt;I want to calculate surgeon volume before 365 days of an index operation on a subject.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have records for a service user, service date and surgeon ID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data WORK.docs_have(label='Surgery Data');
    input  rcpt_id:32. service_date:date9. physician_id:32.;
   format service_date date9.;
 datalines;
 1356 22NOV2008 3354 
 1123 13OCT2010 3354 
 1267 18JAN2011 3354 
 1123 15AUG2011 3354 
 1145 30NOV2009 2234 
 1323 24JAN2010 2234 
 1122 29JAN2010 2234 
 1122 13SEP2010 2234 
 ;;;;&lt;/PRE&gt;&lt;P&gt;and I want Output like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; data WORK.docs_want(label='Surgery Data_want');
    input  rcpt_id:32. service_date:date9. physician_id:32. surg_vol:12;
   format service_date date9.;
 datalines;
 1356 22NOV2008 3354 0
 1123 13OCT2010 3354 0
 1267 18JAN2011 3354 1
 1123 15AUG2011 3354 2
 1145 30NOV2009 2234 0
 1323 24JAN2010 2234 1
 1122 29JAN2010 2234 2
  ;;;;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Aug 2021 21:44:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-determine-surgeon-volume/m-p/760481#M37073</guid>
      <dc:creator>yubaraj</dc:creator>
      <dc:date>2021-08-09T21:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I determine surgeon volume</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-determine-surgeon-volume/m-p/761463#M37157</link>
      <description>&lt;P&gt;Below is an example of how to do something very close to what you want.&amp;nbsp; I'm using calendar year in this example, but I believe you want a 365 day period not just calendar year.&amp;nbsp; You would need to modify my example if calendar year is not what you want, but the solution should be along the lines of what I have coded.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WORK.docs_have(label='Surgery Data');
    input  rcpt_id:32. service_date:date9. physician_id:32.;
   format service_date date9.;
 datalines;
 1356 22NOV2008 3354 
 1123 13OCT2010 3354 
 1267 18JAN2011 3354 
 1123 15AUG2011 3354 
 1145 30NOV2009 2234 
 1323 24JAN2010 2234 
 1122 29JAN2010 2234 
 1122 13SEP2010 2234 
 ;;;;
 run;

 PROC	SQL;
 	CREATE	TABLE	WORK.Surgery_Volume	AS
 	SELECT	Physician_ID
			, YEAR(Service_Date)		AS	Year
			,COUNT(YEAR(Service_Date))	AS	Total_Vol
		FROM	WORK.Docs_Have
		GROUP	BY	Physician_ID, Year
		;
 QUIT;

 PROC	SQL;
 	CREATE	TABLE	WORK.Docs_Vol		AS
	 	SELECT	Rcpt_ID
				,Service_Date
				,Docs.Physician_ID
				,Year
				,Total_Vol
			FROM			WORK.Docs_Have		Docs
			INNER	JOIN	WORK.Surgery_Volume	Surg
				ON	Docs.Physician_ID	=	Surg.Physician_ID
				AND	YEAR(Service_Date)	=	Year
				;
 QUIT;

 PROC	SORT	DATA=WORK.Docs_Vol;
 	BY	Physician_ID	Year	Total_Vol;
 QUIT;

 DATA	WORK.Docs_Want;
 	DROP	Year	
			Total_Vol
			;
 	SET	WORK.Docs_Vol;
 	BY	Physician_ID	Year	Total_Vol;

	IF	Total_Vol						&amp;gt;	1	THEN
		DO;
			IF	FIRST.Total_Vol					THEN
				Surg_Vol				=	1;
			ELSE
				Surg_Vol				+	1;
		END;
	ELSE
		DO;
			Surg_Vol					=	0;
		END;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_0-1628871247772.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62560iB114D37518A29789/image-size/large?v=v2&amp;amp;px=999" role="button" title="jimbarbour_0-1628871247772.png" alt="jimbarbour_0-1628871247772.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 16:16:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-determine-surgeon-volume/m-p/761463#M37157</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-08-13T16:16:03Z</dc:date>
    </item>
  </channel>
</rss>

