sas33 Tracker
https://communities.sas.com/kntur85557/tracker
sas33 TrackerFri, 19 Jul 2024 20:43:43 GMT2024-07-19T20:43:43ZRe: Finding matched Diagnosis code
https://communities.sas.com/t5/SAS-Programming/Finding-matched-Diagnosis-code/m-p/677787#M204508
<BR />Hi ballardw,<BR />No, the order is not important, finding a match is important.<BR />Number of Diagnosis codes is unknown.<BR />I want keep only one diagnosis code that matches, if there are duplicate codes for the same id<BR />ICD10 code list not an exhaustive, it contains more codes about 100.<BR />Wed, 19 Aug 2020 13:29:51 GMThttps://communities.sas.com/t5/SAS-Programming/Finding-matched-Diagnosis-code/m-p/677787#M204508sas332020-08-19T13:29:51ZFinding matched Diagnosis code
https://communities.sas.com/t5/SAS-Programming/Finding-matched-Diagnosis-code/m-p/677653#M204430
<P>Hello,</P><P> </P><P>i have dataset with member id along with diagnosis codes, that needs to be bumped against certain icd10 code list.</P><P>If there a match found, i just want to output the matched code into new column.</P><P>How do i achieve it.</P><P> </P><P>below is the sample data.</P><P>member dataset</P><TABLE><TBODY><TR><TD>Memberid</TD><TD>Diagnosis</TD></TR><TR><TD>8001</TD><TD>R413 E039 H900 NA</TD></TR><TR><TD>8002</TD><TD>I10 R9431 R4181 Z23 E119</TD></TR><TR><TD>8003</TD><TD>G9341 R4189 G4701 I639 NA</TD></TR><TR><TD>8004</TD><TD>I2699 R413 E119 E782 E039</TD></TR><TR><TD>8005</TD><TD>G4752 F0390 Z6828 R296 R2681 R413 G609 I672 NA</TD></TR><TR><TD>8006</TD><TD>I63511 I10 Z6822 G3184 K3184 R4182 R4181 E538 L988 I69354 F0390 E119</TD></TR><TR><TD>8007</TD><TD>M79641 R29898 E1142 R41841 I130</TD></TR><TR><TD>8008</TD><TD>B348 G309 F0280 J449 NA F0390 R1312 R2689 F419 F329 E039 I10 J209 J329 R5081</TD></TR></TBODY></TABLE><P> </P><P>icd10 dataset;</P><TABLE border="0" cellspacing="0" cellpadding="0"><TBODY><TR><TD>ICD9_10</TD></TR><TR><TD>R413</TD></TR><TR><TD>R4931</TD></TR><TR><TD>E119</TD></TR><TR><TD>E782</TD></TR><TR><TD>F0390</TD></TR><TR><TD>L988</TD></TR><TR><TD>I130</TD></TR><TR><TD>F329</TD></TR></TBODY></TABLE><P> </P><P>Expected Output;</P><P> </P><TABLE><TBODY><TR><TD>Memberid</TD><TD>Diagnosis</TD><TD>Match1</TD><TD>Match2</TD><TD>Match3</TD></TR><TR><TD>8001</TD><TD>R413 E039 H900 NA</TD><TD>R413</TD><TD> </TD><TD> </TD></TR><TR><TD>8002</TD><TD>I10 R9431 R4181 Z23 E119</TD><TD>E119</TD><TD> </TD><TD> </TD></TR><TR><TD>8003</TD><TD>G9341 R4189 G4701 I639 NA</TD><TD> </TD><TD> </TD><TD> </TD></TR><TR><TD>8004</TD><TD>I2699 R413 E119 E782 E039</TD><TD>R413</TD><TD>E119</TD><TD> </TD></TR><TR><TD>8005</TD><TD>G4752 F0390 Z6828 R296 R2681 R413 G609 I672 NA</TD><TD>R413</TD><TD> </TD><TD> </TD></TR><TR><TD>8006</TD><TD>I63511 I10 Z6822 G3184 K3184 R4182 R4181 E538 L988 I69354 F0390 E119</TD><TD>E119</TD><TD>F0390</TD><TD>L988</TD></TR><TR><TD>8007</TD><TD>M79641 R29898 E1142 R41841 I130</TD><TD>I130</TD><TD> </TD><TD> </TD></TR><TR><TD>8008</TD><TD>B348 G309 F0280 J449 NA F0390 R1312 R2689 F419 F329 E039 I10 J209 J329 R5081</TD><TD>F0390</TD><TD>F329</TD><TD> </TD></TR></TBODY></TABLE>Tue, 18 Aug 2020 21:39:57 GMThttps://communities.sas.com/t5/SAS-Programming/Finding-matched-Diagnosis-code/m-p/677653#M204430sas332020-08-18T21:39:57ZRe: Number of Continuous Days
https://communities.sas.com/t5/SAS-Programming/Number-of-Continuous-Days/m-p/636750#M189213
<P>Thank you so much, this works perfect. </P>Thu, 02 Apr 2020 03:00:11 GMThttps://communities.sas.com/t5/SAS-Programming/Number-of-Continuous-Days/m-p/636750#M189213sas332020-04-02T03:00:11ZRe: Number of Continuous Days
https://communities.sas.com/t5/SAS-Programming/Number-of-Continuous-Days/m-p/636717#M189196
Hi, i don't think you have considered 7 day difference logic to be considered as continuous. Please see the highlighted rows in blue.Thu, 02 Apr 2020 00:15:31 GMThttps://communities.sas.com/t5/SAS-Programming/Number-of-Continuous-Days/m-p/636717#M189196sas332020-04-02T00:15:31ZNumber of Continuous Days
https://communities.sas.com/t5/SAS-Programming/Number-of-Continuous-Days/m-p/636698#M189187
<P>Hi,</P><P>i want to calculate Continuous days on a drug by id.</P><P>if the days difference between previous end date & next start date <= 7 days then it is considered as continuous.</P><P> </P><TABLE><TBODY><TR><TD>ID</TD><TD>begin date</TD><TD>end date</TD></TR><TR><TD>1001</TD><TD>2/6/2019</TD><TD>2/12/2019</TD></TR><TR><TD>1001</TD><TD>3/13/2019</TD><TD>3/18/2019</TD></TR><TR><TD>1002</TD><TD>4/4/2019</TD><TD>4/10/2019</TD></TR><TR><TD>1002</TD><TD>4/20/2019</TD><TD>5/12/2019</TD></TR><TR><TD>1002</TD><TD>7/11/2019</TD><TD>7/20/2019</TD></TR><TR><TD>1002</TD><TD>8/6/2019</TD><TD>8/20/2019</TD></TR><TR><TD>1002</TD><TD>8/17/2019</TD><TD>9/5/2019</TD></TR><TR><TD>1002</TD><TD>8/30/2019</TD><TD>9/13/2019</TD></TR><TR><TD>1003</TD><TD>11/7/2019</TD><TD>11/13/2019</TD></TR><TR><TD>1003</TD><TD>11/15/2019</TD><TD>12/14/2019</TD></TR><TR><TD>1003</TD><TD>12/31/2019</TD><TD>1/14/2020</TD></TR></TBODY></TABLE><P> </P><P>Result data set </P><P> </P><TABLE><TBODY><TR><TD>ID</TD><TD>begin date</TD><TD>end date</TD><TD>Days Diff from Prev end date</TD><TD>Continuous Days</TD></TR><TR><TD>1001</TD><TD>2/6/2019</TD><TD>2/12/2019</TD><TD>.</TD><TD>7</TD></TR><TR><TD>1001</TD><TD>3/13/2019</TD><TD>3/18/2019</TD><TD>29</TD><TD>6</TD></TR><TR><TD>1002</TD><TD>4/4/2019</TD><TD>4/10/2019</TD><TD>.</TD><TD>7</TD></TR><TR><TD>1002</TD><TD>4/20/2019</TD><TD>5/12/2019</TD><TD>10</TD><TD>23</TD></TR><TR><TD>1002</TD><TD>7/11/2019</TD><TD>7/20/2019</TD><TD>60</TD><TD>10</TD></TR><TR><TD><FONT color="#0000FF">1002</FONT></TD><TD><FONT color="#0000FF">8/6/2019</FONT></TD><TD><FONT color="#0000FF">8/20/2019</FONT></TD><TD><FONT color="#0000FF">17</FONT></TD><TD><FONT color="#0000FF">15</FONT></TD></TR><TR><TD><FONT color="#0000FF">1002</FONT></TD><TD><FONT color="#0000FF">8/17/2019</FONT></TD><TD><FONT color="#0000FF">9/5/2019</FONT></TD><TD><FONT color="#0000FF">-3</FONT></TD><TD><FONT color="#0000FF">31</FONT></TD></TR><TR><TD><FONT color="#0000FF">1002</FONT></TD><TD><FONT color="#0000FF">8/30/2019</FONT></TD><TD><FONT color="#0000FF">9/13/2019</FONT></TD><TD><FONT color="#0000FF">-6</FONT></TD><TD><FONT color="#0000FF">38</FONT></TD></TR><TR><TD>1003</TD><TD>11/7/2019</TD><TD>11/13/2019</TD><TD>.</TD><TD>7</TD></TR><TR><TD>1003</TD><TD>11/15/2019</TD><TD>12/14/2019</TD><TD>2</TD><TD>37</TD></TR><TR><TD>1003</TD><TD>12/31/2019</TD><TD>1/14/2020</TD><TD>17</TD><TD>15</TD></TR></TBODY></TABLE><P> </P><P>Thanks</P>Wed, 01 Apr 2020 22:46:36 GMThttps://communities.sas.com/t5/SAS-Programming/Number-of-Continuous-Days/m-p/636698#M189187sas332020-04-01T22:46:36ZRe: Distributing missing records randomly by Percentage
https://communities.sas.com/t5/SAS-Programming/Distributing-missing-records-randomly-by-Percentage/m-p/605115#M175537
<P>Here is the code i am trying to use</P><P><BR />data want;<BR />set have;<BR />array x{3} $ 10 ('IT' 'Business' 'HR');<BR />call streaminit(1234);<BR />Dept=x{rand('table',0.6,0.35)};<BR />output;<BR />drop x1-x3;<BR />run;</P><P>ods graphics on;<BR />proc freq data=want;<BR />table dept / plots=FreqPlot(scale=percent);<BR />run;</P><P> </P><TABLE><TBODY><TR><TD>Dept</TD><TD>Frequency</TD><TD>Percent</TD><TD>Cumulative<BR />Frequency</TD><TD>Cumulative<BR />Percent</TD></TR><TR><TD>Business</TD><TD>343</TD><TD>33.83</TD><TD>343</TD><TD>33.83</TD></TR><TR><TD>HR</TD><TD>41</TD><TD>4.04</TD><TD>384</TD><TD>37.87</TD></TR><TR><TD>IT</TD><TD>630</TD><TD>62.13</TD><TD>1014</TD><TD>100.00</TD></TR></TBODY></TABLE><P><BR />i think i wanted to see exact percentages. For example in above case i want to see the distribution as 60%, 35% and 5%, however freq table showing little variance for each dept.</P>Mon, 18 Nov 2019 17:23:43 GMThttps://communities.sas.com/t5/SAS-Programming/Distributing-missing-records-randomly-by-Percentage/m-p/605115#M175537sas332019-11-18T17:23:43ZRe: Distributing missing records randomly by Percentage
https://communities.sas.com/t5/SAS-Programming/Distributing-missing-records-randomly-by-Percentage/m-p/605023#M175492
<P>Thank you everyone. </P><P> </P><P>While most of the solutions seems working as expected, i am leaning towards rand('table',...) function.</P><P> </P><P>i am also looking to see other columns in the result data set along with ID and Department. looks like output statement only puts whatever is in the do loop. what change should i make</P>Mon, 18 Nov 2019 14:47:13 GMThttps://communities.sas.com/t5/SAS-Programming/Distributing-missing-records-randomly-by-Percentage/m-p/605023#M175492sas332019-11-18T14:47:13ZDistributing missing records randomly by Percentage
https://communities.sas.com/t5/SAS-Programming/Distributing-missing-records-randomly-by-Percentage/m-p/604832#M175398
<P>Hi, </P><P> </P><P>i have a following sample data set with missing values, for which I want to set certain value by percentage randomly. 50% of the records belong to 'IT' Dept, and 30% belong to 'Business' and remaining 20% belong 'HR' dept. How do i achieve this. Output may vary but overall percentage should match.</P><P> </P><TABLE border="0" cellspacing="0" cellpadding="0"><TBODY><TR><TD>ID</TD><TD>Department</TD></TR><TR><TD>1</TD><TD> </TD></TR><TR><TD>2</TD><TD> </TD></TR><TR><TD>3</TD><TD> </TD></TR><TR><TD>4</TD><TD> </TD></TR><TR><TD>5</TD><TD> </TD></TR><TR><TD>6</TD><TD> </TD></TR><TR><TD>7</TD><TD> </TD></TR><TR><TD>8</TD><TD> </TD></TR><TR><TD>9</TD><TD> </TD></TR><TR><TD>10</TD><TD> </TD></TR></TBODY></TABLE><P> </P><P>Want:</P><P> </P><TABLE><TBODY><TR><TD>ID</TD><TD>Department</TD></TR><TR><TD>1</TD><TD>IT</TD></TR><TR><TD>2</TD><TD>Business</TD></TR><TR><TD>3</TD><TD>IT</TD></TR><TR><TD>4</TD><TD>HR</TD></TR><TR><TD>5</TD><TD>IT</TD></TR><TR><TD>6</TD><TD>HR</TD></TR><TR><TD>7</TD><TD>IT</TD></TR><TR><TD>8</TD><TD>IT</TD></TR><TR><TD>9</TD><TD>Business</TD></TR><TR><TD>10</TD><TD>Business</TD></TR></TBODY></TABLE><P> </P><P> </P><P> </P>Sun, 17 Nov 2019 19:12:18 GMThttps://communities.sas.com/t5/SAS-Programming/Distributing-missing-records-randomly-by-Percentage/m-p/604832#M175398sas332019-11-17T19:12:18ZRe: identifying new fills
https://communities.sas.com/t5/SAS-Programming/identifying-new-fills/m-p/556395#M155003
<P>Thank you</P>Mon, 06 May 2019 12:15:03 GMThttps://communities.sas.com/t5/SAS-Programming/identifying-new-fills/m-p/556395#M155003sas332019-05-06T12:15:03ZRe: identifying new fills
https://communities.sas.com/t5/SAS-Programming/identifying-new-fills/m-p/555793#M154723
<P>Thanks you novinosrin! This is very close.</P><P> </P><P>If i have additional record in my input as below for id 3000, i am seeing only one record. i want to see both of them.</P><P> </P><P>3000 10/24/2018</P>Thu, 02 May 2019 22:21:49 GMThttps://communities.sas.com/t5/SAS-Programming/identifying-new-fills/m-p/555793#M154723sas332019-05-02T22:21:49ZRe: identifying new fills
https://communities.sas.com/t5/SAS-Programming/identifying-new-fills/m-p/555777#M154710
<P>here is the explanation how i wanted. if there are more fills after on a particular after 120 days since last fill day, i need to show all those records in output.</P><P> </P><P> </P><TABLE><TBODY><TR><TD>id</TD><TD>fill_dt</TD><TD>Days_since_last_fill</TD><TD>Qualifies for output</TD><TD>Comment</TD></TR><TR><TD>1000</TD><TD>08/21/2018</TD><TD> </TD><TD>Y</TD><TD>First Fill Day</TD></TR><TR><TD>2000</TD><TD>02/02/2018</TD><TD> </TD><TD>Y</TD><TD>First Fill Day</TD></TR><TR><TD>2000</TD><TD>02/17/2018</TD><TD>15</TD><TD>N</TD><TD>Days Difference between Last Fill date and current fill date is <120</TD></TR><TR><TD>2000</TD><TD>11/07/2018</TD><TD>263</TD><TD>Y</TD><TD>> 120 days from previous fill </TD></TR><TR><TD>2000</TD><TD>11/12/2018</TD><TD>5</TD><TD>N</TD><TD>Days Difference between Last Fill date and current fill date is lt 120</TD></TR><TR><TD>2000</TD><TD>11/28/2018</TD><TD>16</TD><TD>N</TD><TD>Days Difference between Last Fill date and current fill date is < 120</TD></TR><TR><TD>3000</TD><TD>03/05/2018</TD><TD> </TD><TD>Y</TD><TD>First Fill Day</TD></TR><TR><TD>3000</TD><TD>03/05/2018</TD><TD> </TD><TD>Y</TD><TD>First Fill Day</TD></TR><TR><TD>3000</TD><TD>05/29/2018</TD><TD>85</TD><TD>N</TD><TD>Days Difference between Last Fill date and current fill date is < 120</TD></TR><TR><TD>3000</TD><TD>10/24/2018</TD><TD>148</TD><TD>Y</TD><TD>> 120 days from previous fill </TD></TR><TR><TD>3000</TD><TD>11/24/2018</TD><TD>31</TD><TD>N</TD><TD><P>Days Difference between Last Fill date and current fill date is < 120</P><P> </P></TD></TR></TBODY></TABLE>Thu, 02 May 2019 21:34:09 GMThttps://communities.sas.com/t5/SAS-Programming/identifying-new-fills/m-p/555777#M154710sas332019-05-02T21:34:09Zidentifying new fills
https://communities.sas.com/t5/SAS-Programming/identifying-new-fills/m-p/555729#M154680
<P>Hi</P><P>i have following data set and i would like to create output as shown below. i need to output the records if difference between current fill date and last fill dt is > 120 with in id.</P><P>data have;<BR />infile datalines dsd truncover;<BR />input id $10. fill_dt:mmddyy10.;<BR />format fill_dt MMDDYY10.;<BR />datalines;<BR />1000 08/21/2018<BR />2000 02/02/2018<BR />2000 02/17/2018<BR />2000 11/07/2018<BR />2000 11/12/2018<BR />2000 11/28/2018<BR />3000 03/05/2018<BR />3000 03/05/2018<BR />3000 05/29/2018<BR />3000 10/24/2018<BR />3000 11/24/2018<BR />;<BR />run;</P><P> </P><P>Output:</P><P> </P><P>1000 08/21/2018<BR />2000 02/02/2018<BR />2000 11/07/2018<BR />3000 03/05/2018<BR />3000 03/05/2018<BR />3000 10/24/2018</P>Thu, 02 May 2019 19:16:57 GMThttps://communities.sas.com/t5/SAS-Programming/identifying-new-fills/m-p/555729#M154680sas332019-05-02T19:16:57ZRe: Averages summary level
https://communities.sas.com/t5/SAS-Programming/Averages-summary-level/m-p/536064#M147271
<P>i am adding up <SPAN>23.325+25+16.66666667 and dividing by 3 for 30MG.</SPAN></P><P> </P><P><SPAN>same for 90mg. adding 44+15 and dividing by 2.</SPAN></P>Fri, 15 Feb 2019 21:22:46 GMThttps://communities.sas.com/t5/SAS-Programming/Averages-summary-level/m-p/536064#M147271sas332019-02-15T21:22:46ZRe: Averages summary level
https://communities.sas.com/t5/SAS-Programming/Averages-summary-level/m-p/536028#M147248
<P>Thank you, Paige Miller.</P><P> </P><P>i am expecting following result..and i am seeing a variance in average. how do i achieve below numbers</P><P> </P><TABLE><TBODY><TR><TD>Brand_name</TD><TD>Strength</TD><TD>Pharmacy</TD><TD>cost</TD><TD>Average_qty</TD><TD> </TD></TR><TR><TD>Drug2</TD><TD> </TD><TD> </TD><TD>$64,168.68</TD><TD>25.88235294</TD><TD> </TD></TR><TR><TD>Drug2</TD><TD>30 MG</TD><TD> </TD><TD>$31,166.68</TD><TD><FONT color="#FF0000">23.23076923</FONT></TD><TD> </TD></TR><TR><TD>Drug2</TD><TD>60 MG</TD><TD> </TD><TD>$20,396.36</TD><TD>35.45454545</TD><TD> </TD></TR><TR><TD>Drug2</TD><TD>90 MG</TD><TD> </TD><TD>$12,605.64</TD><TD><FONT color="#0000FF">32.4</FONT></TD><TD> </TD></TR><TR><TD>Drug2</TD><TD>30 MG</TD><TD>OTHER</TD><TD>$23,832.40</TD><TD>23.325</TD><TD><FONT color="#FF0000">21.66389</FONT></TD></TR><TR><TD>Drug2</TD><TD>30 MG</TD><TD>PHARMACY1</TD><TD>$6,004.26</TD><TD>25</TD><TD> </TD></TR><TR><TD>Drug2</TD><TD>30 MG</TD><TD>PHARMACY2</TD><TD>$1,330.02</TD><TD>16.66666667</TD><TD> </TD></TR><TR><TD>Drug2</TD><TD>60 MG</TD><TD>OTHER</TD><TD>$12,393.91</TD><TD>34.28571429</TD><TD> </TD></TR><TR><TD>Drug2</TD><TD>60 MG</TD><TD>PHARMACY1</TD><TD>$8,002.45</TD><TD>37.5</TD><TD> </TD></TR><TR><TD>Drug2</TD><TD>90 MG</TD><TD>OTHER</TD><TD>$2,254.02</TD><TD>15</TD><TD><FONT color="#0000FF">29.5</FONT></TD></TR><TR><TD>Drug2</TD><TD>90 MG</TD><TD>PHARMACY3</TD><TD>$10,351.62</TD><TD>44</TD><TD> </TD></TR></TBODY></TABLE>Fri, 15 Feb 2019 20:16:41 GMThttps://communities.sas.com/t5/SAS-Programming/Averages-summary-level/m-p/536028#M147248sas332019-02-15T20:16:41ZAverages summary level
https://communities.sas.com/t5/SAS-Programming/Averages-summary-level/m-p/535965#M147227
<P>Hi, i have following data set , can you help in creating a desired output as below.</P><P> </P><TABLE><TBODY><TR><TD>Quantity</TD><TD>Pharmacy</TD><TD>Brand_name</TD><TD>cost</TD><TD>Strength</TD></TR><TR><TD>15</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$391.63</TD><TD>30 MG</TD></TR><TR><TD>15</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$382.38</TD><TD>30 MG</TD></TR><TR><TD>8</TD><TD>PHARMACY2</TD><TD>Drug2</TD><TD>$213.32</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,553.80</TD><TD>60 MG</TD></TR><TR><TD>44</TD><TD>PHARMACY3</TD><TD>Drug2</TD><TD>$3,450.54</TD><TD>90 MG</TD></TR><TR><TD>44</TD><TD>PHARMACY3</TD><TD>Drug2</TD><TD>$3,450.54</TD><TD>90 MG</TD></TR><TR><TD>44</TD><TD>PHARMACY3</TD><TD>Drug2</TD><TD>$3,450.54</TD><TD>90 MG</TD></TR><TR><TD>31</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$824.25</TD><TD>30 MG</TD></TR><TR><TD>31</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$802.85</TD><TD>30 MG</TD></TR><TR><TD>31</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$802.85</TD><TD>30 MG</TD></TR><TR><TD>15</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$400.44</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$764.75</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$779.27</TD><TD>30 MG</TD></TR><TR><TD>23</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$586.31</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$782.47</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$782.47</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$782.47</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$800.49</TD><TD>30 MG</TD></TR><TR><TD>4</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$101.97</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$800.49</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$776.18</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$779.86</TD><TD>30 MG</TD></TR><TR><TD>60</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$3,127.55</TD><TD>60 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$764.75</TD><TD>30 MG</TD></TR><TR><TD>15</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$382.38</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$776.95</TD><TD>30 MG</TD></TR><TR><TD>60</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,140.93</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$800.49</TD><TD>30 MG</TD></TR><TR><TD>60</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$3,200.74</TD><TD>60 MG</TD></TR><TR><TD>12</TD><TD>PHARMACY2</TD><TD>Drug2</TD><TD>$319.49</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,529.50</TD><TD>60 MG</TD></TR><TR><TD>16</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$420.08</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$764.75</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY2</TD><TD>Drug2</TD><TD>$797.21</TD><TD>30 MG</TD></TR><TR><TD>7</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$205.23</TD><TD>30 MG</TD></TR><TR><TD>7</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$205.23</TD><TD>30 MG</TD></TR><TR><TD>7</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$205.23</TD><TD>30 MG</TD></TR><TR><TD>13</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$331.39</TD><TD>30 MG</TD></TR><TR><TD>4</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$107.16</TD><TD>30 MG</TD></TR><TR><TD>15</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$400.44</TD><TD>30 MG</TD></TR><TR><TD>15</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$400.44</TD><TD>30 MG</TD></TR><TR><TD>13</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$307.85</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,529.50</TD><TD>60 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$800.49</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$800.49</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$800.49</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$782.47</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,553.80</TD><TD>60 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,553.80</TD><TD>60 MG</TD></TR><TR><TD>15</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,127.01</TD><TD>90 MG</TD></TR><TR><TD>15</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,127.01</TD><TD>90 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$779.86</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,545.96</TD><TD>60 MG</TD></TR><TR><TD>15</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$400.44</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$1,600.57</TD><TD>60 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$1,600.57</TD><TD>60 MG</TD></TR><TR><TD>45</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,147.13</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$785.05</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$800.49</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$782.47</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$785.05</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$1,600.57</TD><TD>60 MG</TD></TR><TR><TD>8</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$212.71</TD><TD>30 MG</TD></TR><TR><TD>8</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$212.71</TD><TD>30 MG</TD></TR><TR><TD>15</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$391.63</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$764.75</TD><TD>30 MG</TD></TR><TR><TD>20</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$518.00</TD><TD>30 MG</TD></TR><TR><TD>20</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$518.00</TD><TD>30 MG</TD></TR></TBODY></TABLE><P> </P><P>output desired</P><TABLE><TBODY><TR><TD>Year</TD><TD>Brand</TD><TD>Strength</TD><TD>Pharmacy Name</TD><TD>Total Cost</TD><TD>Avg. Units Dispensed</TD></TR><TR><TD>2019</TD><TD>Drug2</TD><TD> </TD><TD> </TD><TD>$48,377.85</TD><TD>29</TD></TR><TR><TD>2019</TD><TD>Drug2</TD><TD>30 MG</TD><TD> </TD><TD>$16,905.35</TD><TD>24</TD></TR><TR><TD> </TD><TD>Drug2</TD><TD>30 MG</TD><TD>Other</TD><TD>$12,292.42</TD><TD>26</TD></TR><TR><TD> </TD><TD>Drug2</TD><TD>30 MG</TD><TD>Pharmacy1</TD><TD>$3,602.40</TD><TD>27</TD></TR><TR><TD> </TD><TD>Drug2</TD><TD>30 MG</TD><TD>Pharmacy2</TD><TD>$1,010.53</TD><TD>19</TD></TR><TR><TD>2019</TD><TD>Drug2</TD><TD>60 MG</TD><TD> </TD><TD>$18,866.86</TD><TD>36</TD></TR><TR><TD> </TD><TD>Drug2</TD><TD>60 MG</TD><TD>Other</TD><TD>$10,864.41</TD><TD>35</TD></TR><TR><TD> </TD><TD>Drug2</TD><TD>60 MG</TD><TD>Pharmacy1</TD><TD>$8,002.45</TD><TD>38</TD></TR><TR><TD>2019</TD><TD>Drug2</TD><TD>90 MG</TD><TD> </TD><TD>$12,605.64</TD><TD>30</TD></TR><TR><TD> </TD><TD>Drug2</TD><TD>90 MG</TD><TD>Pharmacy3</TD><TD>$10,351.62</TD><TD>44</TD></TR><TR><TD> </TD><TD>Drug2</TD><TD>90 MG</TD><TD>Other</TD><TD>$2,254.02</TD><TD>15</TD></TR></TBODY></TABLE>Fri, 15 Feb 2019 19:08:44 GMThttps://communities.sas.com/t5/SAS-Programming/Averages-summary-level/m-p/535965#M147227sas332019-02-15T19:08:44ZAverages at detail and summary level
https://communities.sas.com/t5/SAS-Programming/Averages-at-detail-and-summary-level/m-p/535950#M147223
<P>Hi , i have following detailed output dataset </P><P>.</P><TABLE><TBODY><TR><TD>Quantity</TD><TD>Pharmacy</TD><TD>Brand_name</TD><TD>cost</TD><TD>Strength</TD></TR><TR><TD>15</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$391.63</TD><TD>30 MG</TD></TR><TR><TD>15</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$382.38</TD><TD>30 MG</TD></TR><TR><TD>8</TD><TD>PHARMACY2</TD><TD>Drug2</TD><TD>$213.32</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,553.80</TD><TD>60 MG</TD></TR><TR><TD>44</TD><TD>PHARMACY3</TD><TD>Drug2</TD><TD>$3,450.54</TD><TD>90 MG</TD></TR><TR><TD>44</TD><TD>PHARMACY3</TD><TD>Drug2</TD><TD>$3,450.54</TD><TD>90 MG</TD></TR><TR><TD>44</TD><TD>PHARMACY3</TD><TD>Drug2</TD><TD>$3,450.54</TD><TD>90 MG</TD></TR><TR><TD>31</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$824.25</TD><TD>30 MG</TD></TR><TR><TD>31</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$802.85</TD><TD>30 MG</TD></TR><TR><TD>31</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$802.85</TD><TD>30 MG</TD></TR><TR><TD>15</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$400.44</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$764.75</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$779.27</TD><TD>30 MG</TD></TR><TR><TD>23</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$586.31</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$782.47</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$782.47</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$782.47</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$800.49</TD><TD>30 MG</TD></TR><TR><TD>4</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$101.97</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$800.49</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$776.18</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$779.86</TD><TD>30 MG</TD></TR><TR><TD>60</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$3,127.55</TD><TD>60 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$764.75</TD><TD>30 MG</TD></TR><TR><TD>15</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$382.38</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$776.95</TD><TD>30 MG</TD></TR><TR><TD>60</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,140.93</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$800.49</TD><TD>30 MG</TD></TR><TR><TD>60</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$3,200.74</TD><TD>60 MG</TD></TR><TR><TD>12</TD><TD>PHARMACY2</TD><TD>Drug2</TD><TD>$319.49</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,529.50</TD><TD>60 MG</TD></TR><TR><TD>16</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$420.08</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$764.75</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY2</TD><TD>Drug2</TD><TD>$797.21</TD><TD>30 MG</TD></TR><TR><TD>7</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$205.23</TD><TD>30 MG</TD></TR><TR><TD>7</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$205.23</TD><TD>30 MG</TD></TR><TR><TD>7</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$205.23</TD><TD>30 MG</TD></TR><TR><TD>13</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$331.39</TD><TD>30 MG</TD></TR><TR><TD>4</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$107.16</TD><TD>30 MG</TD></TR><TR><TD>15</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$400.44</TD><TD>30 MG</TD></TR><TR><TD>15</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$400.44</TD><TD>30 MG</TD></TR><TR><TD>13</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$307.85</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,529.50</TD><TD>60 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$800.49</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$800.49</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$800.49</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$782.47</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,553.80</TD><TD>60 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,553.80</TD><TD>60 MG</TD></TR><TR><TD>15</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,127.01</TD><TD>90 MG</TD></TR><TR><TD>15</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,127.01</TD><TD>90 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$779.86</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,545.96</TD><TD>60 MG</TD></TR><TR><TD>15</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$400.44</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$1,600.57</TD><TD>60 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$1,600.57</TD><TD>60 MG</TD></TR><TR><TD>45</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$1,147.13</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$785.05</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$800.49</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$782.47</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$785.05</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>PHARMACY1</TD><TD>Drug2</TD><TD>$1,600.57</TD><TD>60 MG</TD></TR><TR><TD>8</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$212.71</TD><TD>30 MG</TD></TR><TR><TD>8</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$212.71</TD><TD>30 MG</TD></TR><TR><TD>15</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$391.63</TD><TD>30 MG</TD></TR><TR><TD>30</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$764.75</TD><TD>30 MG</TD></TR><TR><TD>20</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$518.00</TD><TD>30 MG</TD></TR><TR><TD>20</TD><TD>OTHER</TD><TD>Drug2</TD><TD>$518.00</TD><TD>30 MG</TD></TR></TBODY></TABLE><P>i wanted to summary dataset as something similar below</P><P> </P><TABLE><TBODY><TR><TD>Year</TD><TD>Brand</TD><TD>Strength</TD><TD>Pharmacy Name</TD><TD>Total Cost</TD><TD>Avg. Units Dispensed</TD></TR><TR><TD><FONT color="#0000FF">2019</FONT></TD><TD><FONT color="#0000FF">Drug</FONT>2</TD><TD> </TD><TD> </TD><TD><FONT color="#0000FF">$48,377.85</FONT></TD><TD><FONT color="#0000FF">29</FONT></TD></TR><TR><TD><FONT color="#FF0000">2019</FONT></TD><TD><FONT color="#FF0000">Drug2</FONT></TD><TD><FONT color="#FF0000">30 MG</FONT></TD><TD> </TD><TD><FONT color="#FF0000">$16,905.35</FONT></TD><TD><FONT color="#FF0000">24</FONT></TD></TR><TR><TD> </TD><TD>Drug2</TD><TD>30 MG</TD><TD>Other</TD><TD>$12,292.42</TD><TD>26</TD></TR><TR><TD> </TD><TD>Drug2</TD><TD>30 MG</TD><TD>Pharmacy1</TD><TD>$3,602.40</TD><TD>27</TD></TR><TR><TD> </TD><TD>Drug2</TD><TD>30 MG</TD><TD>Pharmacy2</TD><TD>$1,010.53</TD><TD>19</TD></TR><TR><TD>2019</TD><TD>Drug2</TD><TD>60 MG</TD><TD> </TD><TD><FONT color="#FF0000">$18,866.86</FONT></TD><TD><FONT color="#FF0000">36</FONT></TD></TR><TR><TD> </TD><TD>Drug2</TD><TD>60 MG</TD><TD>Other</TD><TD>$10,864.41</TD><TD>35</TD></TR><TR><TD> </TD><TD>Drug2</TD><TD>60 MG</TD><TD>Pharmacy1</TD><TD>$8,002.45</TD><TD>38</TD></TR><TR><TD>2019</TD><TD>Drug2</TD><TD>90 MG</TD><TD> </TD><TD><FONT color="#FF0000">$12,605.64</FONT></TD><TD><FONT color="#FF0000">30</FONT></TD></TR><TR><TD> </TD><TD>Drug2</TD><TD>90 MG</TD><TD>Pharmacy3</TD><TD>$10,351.62</TD><TD>44</TD></TR><TR><TD> </TD><TD>Drug2</TD><TD>90 MG</TD><TD>Other</TD><TD>$2,254.02</TD><TD>15</TD></TR></TBODY></TABLE><P> </P><P>can you please help</P>Fri, 15 Feb 2019 18:10:10 GMThttps://communities.sas.com/t5/SAS-Programming/Averages-at-detail-and-summary-level/m-p/535950#M147223sas332019-02-15T18:10:10Z