<?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 unique recipients by age groups that received all psychotropic meds (total of five class in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935193#M367703</link>
    <description>&lt;P&gt;Caveat: without actual data of some sort determining "all" of anything is problematic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you verified that none of your Recipient_ID values changed age_group in any of the data sets? It is very likely that from one calendar month to another that an individual would change age and likely age group. So a rule involving that situation as it relates to the desired report is needed before starting. Since you are looking overall at a two year period you are certain to have some change age groups and how that affects the report is needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that some details of the required report are missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see nothing in your attempt that takes the different medications into account. Your SQL dumps all the records into one call and counts by age_group only, nothing by medication.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest providing a small example of data that looks like your 5 anti_anxiety_2022, anti-psychotic_2022 etc. data sets. Make sure to have at least 2 participants that are "all 5 medications" and some that aren't. Then show what the expected result (MANUALLY calculated which is why the set should be small) from is expected to look like.&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jul 2024 16:52:31 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-07-09T16:52:31Z</dc:date>
    <item>
      <title>finding unique recipients by age groups that received all psychotropic meds (total of five classes)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935179#M367699</link>
      <description>&lt;P&gt;I am looking at 5 classes of psychotropic meds (anti_anxiety, anti_psychotic, anti_depressant, mood_stabilizer, stimulants) over two years 2022 and 2023.&lt;/P&gt;
&lt;P&gt;The age groups are 0-5, 6-12, 13-17.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Each year was extracted by quarter by the month of the quarter.&amp;nbsp; So there are 4 groupings for each drug class:&lt;/P&gt;
&lt;P&gt;anti_anxiety_2022_q1_1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; anti_anxiety for 2022 for qtr 1 January&lt;/P&gt;
&lt;P&gt;anti_anxiety_2022_q1_2 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; anti_anxiety for 2022 for qtr 1 February&lt;/P&gt;
&lt;P&gt;anti_anxiety_2022_q1_3 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; anti_anxiety for 2022 for qtr 1 March&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; . . .&lt;/P&gt;
&lt;P&gt;anti_anxiety_2022_q4_1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; anti_anxiety for 2022 for qtr 4 October&lt;/P&gt;
&lt;P&gt;anti_anxiety_2022_q4_2 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; anti_anxiety for 2022 for qtr 4 November&lt;/P&gt;
&lt;P&gt;anti_anxiety_2022_q4_3 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; anti_anxiety for 2022 for qtr 4 December&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data for each of the other 4 med classes are have similar construction&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data is cleaned up a little (e.g. if header_amount_paid = 0, record is deleted)&lt;/P&gt;
&lt;P&gt;Age groupings are added&lt;/P&gt;
&lt;P&gt;SQL coding is used to create&lt;/P&gt;
&lt;P&gt;So a hypothetical anxiety quarterly dataset (Q1) looks like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From DOS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Recipient_ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Total_Paid&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Age_group&lt;/P&gt;
&lt;P&gt;30Jan22&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EO401J5K&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; 132.86&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0-5&lt;/P&gt;
&lt;P&gt;05FEB22&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BY3267G1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 43.55&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 13-17&lt;/P&gt;
&lt;P&gt;28MAR22&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PA601M4L&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 67.73&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6-12&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The four quarters for each med were set together to give&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anxiety_2022_final&lt;/P&gt;
&lt;P&gt;Psychotic_2022_final&lt;/P&gt;
&lt;P&gt;Depressant_2022_final&lt;/P&gt;
&lt;P&gt;Mood_Stable_2022_final&lt;/P&gt;
&lt;P&gt;Stimulants_2022_final&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The request is to get a count of unique recipients that received all 5 drugs for each age grouping.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My approach was to do the following&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data all drugs_2022;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Set anti_anxiety_2022&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; anti-psychotic_2022&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; anti_depress_2022&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; anti_mood_2022&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; anti_stimulant_2022;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=all_drugs_2022&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out=uniquerecipients_2022 nodups&amp;nbsp; dupout=dup_recipients_2022 nodupkey;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by Recipient_ID;&lt;/P&gt;
&lt;P&gt;proc sql noprint;&lt;/P&gt;
&lt;P&gt;create table unique_rec_meds_2022 AS&lt;/P&gt;
&lt;P&gt;select&amp;nbsp; From_DOS, Recipient_ID, Sum(header_amount_paid) AS Total_paid, Age_group,&lt;/P&gt;
&lt;P&gt;COUNT(Age_group) AS A_grp&lt;/P&gt;
&lt;P&gt;From all_drugs_2022&lt;/P&gt;
&lt;P&gt;Group By age_group;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the final result would be a excel table (results are hypothetical for illustration)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CY 2022&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Age_group&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Recipients&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Payments&lt;/P&gt;
&lt;P&gt;2022&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0-5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8,235&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $1,644,876&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6-12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 41,875&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $39,546,233&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 13-17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 54,712&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $31,876,098&lt;/P&gt;
&lt;P&gt;and a similar table for CY 2023&lt;/P&gt;
&lt;P&gt;I thought this would produce a table of the number of children who received all&lt;/P&gt;
&lt;P&gt;psychotropic drugs, by age group, and payments&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the requester doesn't think so.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At this point, I am confused then on how to arrive at the correct result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestions and direction will be appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;wlierman&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The same final output&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;data anxiety_2022_q1_1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set anxiety_2022;&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 16:21:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935179#M367699</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2024-07-09T16:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: finding unique recipients by age groups that received all psychotropic meds (total of five class</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935193#M367703</link>
      <description>&lt;P&gt;Caveat: without actual data of some sort determining "all" of anything is problematic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you verified that none of your Recipient_ID values changed age_group in any of the data sets? It is very likely that from one calendar month to another that an individual would change age and likely age group. So a rule involving that situation as it relates to the desired report is needed before starting. Since you are looking overall at a two year period you are certain to have some change age groups and how that affects the report is needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that some details of the required report are missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see nothing in your attempt that takes the different medications into account. Your SQL dumps all the records into one call and counts by age_group only, nothing by medication.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest providing a small example of data that looks like your 5 anti_anxiety_2022, anti-psychotic_2022 etc. data sets. Make sure to have at least 2 participants that are "all 5 medications" and some that aren't. Then show what the expected result (MANUALLY calculated which is why the set should be small) from is expected to look like.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 16:52:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935193#M367703</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-07-09T16:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: finding unique recipients by age groups that received all psychotropic meds (total of five class</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935204#M367710</link>
      <description>&lt;P&gt;I assume AGE, AGE_GROUP are only Baseline observations and don't change over time.&amp;nbsp;&lt;BR /&gt;To calculate RECIPENTS number and TOTAL_AMOUNT spent by MEDICATION, AGE_GROUP, QUARTER and YEAR I would do smth like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let drugs= 'anti_anxiety' 'anti_psychotic' 'anti_depressant' 'mood_stabilizer' 'stimulants';

data have; 
	set &amp;lt;input data&amp;gt;; 
	where lowcase(MEDS) in (&amp;amp;drugs) and HEADER_AMOUNT_PAID &amp;gt;0 and (FROM_DOS between '01Jan2022'd and '31Dec2023'd);
	year= year(FROM_DOS); 
	if month(FROM_DOS) in (1, 2, 3) then QUARTER='q1';
	else if month(FROM_DOS) in (4, 5, 6) then QUARTER='q2';
	else if month(FROM_DOS) in (7, 8, 9) then QUARTER='q3';
	else if QUARTER='q4';
run; 
proc means data=have n sum noprint nway;
	class YEAR QUARTER AGE_GROUP MEDS; 
	ways 4; 
	var HEADER_AMOUNT_PAID;
	output out= summary n=RECIPIENTS sum=PAYMENTS;
	format payments dollar12.; 
run; 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Jul 2024 17:47:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935204#M367710</guid>
      <dc:creator>A_Kh</dc:creator>
      <dc:date>2024-07-09T17:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: finding unique recipients by age groups that received all psychotropic meds (total of five class</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935206#M367711</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;The request is to get a count of unique recipients that received all 5 drugs for each age grouping.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My approach was to do the following&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data all drugs_2022;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Set anti_anxiety_2022&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; anti-psychotic_2022&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; anti_depress_2022&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; anti_mood_2022&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; anti_stimulant_2022;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This should work:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data all_drugs_2022;
    merge anti_anxiety_2022(in=in1 keep=recipient_id age_group) anti_psychotic_2022(in=in2 keep=recipient_id age_group)
        anti_depress_2022(in=in3 keep=recipient_id age_group) anti_mood_2022(in=in4 keep=recipient_id age_group)
        anti_stimulant_2022(in=in5 keep=recipient_id age_group);
    by recipient_id;
    if in1 and in2 and in3 and in4 and in5;
run;

/* Get the count */
proc sql;
     create table count as select count(distinct recipient_id) from all_drugs_2022 group by age_group;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This assumes all data sets are sorted by recipient_id&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 18:39:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935206#M367711</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-07-09T18:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: finding unique recipients by age groups that received all psychotropic meds (total of five class</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935217#M367716</link>
      <description>Hello,&lt;BR /&gt;Thank you for responding.  I will follow your suggestions and prepare a small data set for further examination &lt;BR /&gt;&lt;BR /&gt;Wlierman&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Jul 2024 19:09:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935217#M367716</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2024-07-09T19:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: finding unique recipients by age groups that received all psychotropic meds (total of five class</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935322#M367740</link>
      <description>Thank you. That does work (though it is somewhat hard to explain at least for me).  The only other filter (that I didn't mention) was that the recipients needed to be unique (deduplicated).I did that which lowered the over all total.  Thanks again for your help and suggestion.</description>
      <pubDate>Wed, 10 Jul 2024 14:04:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935322#M367740</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2024-07-10T14:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: finding unique recipients by age groups that received all psychotropic meds (total of five class</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935324#M367741</link>
      <description>Thank you for your suggestions and help.</description>
      <pubDate>Wed, 10 Jul 2024 14:06:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935324#M367741</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2024-07-10T14:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: finding unique recipients by age groups that received all psychotropic meds (total of five class</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935325#M367742</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/65907"&gt;@wlierman&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you. That does work (though it is somewhat hard to explain at least for me). The only other filter (that I didn't mention) was that the recipients needed to be unique (deduplicated).I did that which lowered the over all total. Thanks again for your help and suggestion.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Explanation: The variable IN1 is 1 if the data comes from anti_anxiety_2022 and 0 otherwise. The variable IN2 is 1 if the data comes from anti_psychotic_2022 and 0 otherwise. When all five data sets are merged, you want the cases where all IN1 through IN5 have value of 1 (can't have any of them zero) and so that's what the IF statement looks for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Doesn't the PROC SQL use of DISTINCT de-duplicate the counts?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 14:09:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935325#M367742</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-07-10T14:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: finding unique recipients by age groups that received all psychotropic meds (total of five class</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935343#M367747</link>
      <description>&lt;P&gt;I didn't use the Distinct in proc Sql (though I could have).&amp;nbsp; I ran a proc sort (by Recipient_ID)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=Analyze2.all_drugs_2022&lt;BR /&gt;out=Analyze2.uniquerecipients_2022 nodups;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*dupout = Analyze2.dup_recipients_2023 nodupkey;*/&lt;BR /&gt;by Recipient_ID;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have a large state Medicaid program. But even so, it is somewhat disconcerting that there are over 50K (at least from our Business Intelligence / Business Objects data warehouse) recipients (children in the 0-5 age group that have received all five classes of drugs. Though I think some of that is the NDC code (like " children acetaminophen" as well as others that I would not have considered in a psychotropic drug class).&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 15:13:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-unique-recipients-by-age-groups-that-received-all/m-p/935343#M367747</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2024-07-10T15:13:22Z</dc:date>
    </item>
  </channel>
</rss>

