<?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 Identifying brand and generic drugs when ther are several generic drugs in a &amp;quot;cocktail mix&amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Identifying-brand-and-generic-drugs-when-ther-are-several/m-p/641491#M191188</link>
    <description>&lt;P&gt;I have a SAS output data set of drugs prescribed for a Medicaid population.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two issues: 1) setting up a if-then-else section to search for specific hiv/aids drugs by brand and/or generic. The following is the coding. The brand name is mentioned first and the generic is second. Another wrinkle is that there is one brand but (many times) several generics (or more like generic cocktail mix). (There are many lines so I am going to shorten the example. )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data hivaids.hivaids_drugs (keep = DSC_NDC label);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set hal_data.mcaid_drug_dn;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If dsc_ndc eq "Emtriva" or "emtricitabine" then label eq "Yes";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Else If dsc_ndc eq "Delstrigo" or "doravirine" and "lamivudine" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; "tenofovir disoproxil fumarate" then label eq "Yes";&lt;/P&gt;&lt;P&gt;:&lt;/P&gt;&lt;P&gt;:&lt;/P&gt;&lt;P&gt;:&lt;/P&gt;&lt;P&gt;Else If dsc_ndc eq "Kaletra" or "lopinavir" and "ritonavir" then label eq "Yes";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the error I run into is&lt;/P&gt;&lt;P&gt;INVALID numeric data, &amp;lt;&amp;lt; drug name &amp;gt;&amp;gt; at line xxxx column xx&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That error repeats many times.&amp;nbsp; All the drug names on the right hand side of&lt;/P&gt;&lt;P&gt;the&amp;nbsp; OR are the generics and there can be from two to five. I separated each by AND.&lt;/P&gt;&lt;P&gt;I received output which was basically just the column DSC_NDC in the SAS&lt;/P&gt;&lt;P&gt;output set.&amp;nbsp; What I really want is to match the list of hiv/aids drugs against the SAS output set and then only keep those where label = "Yes".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is the first problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Secondly in the SAS output set there may be several lines for the same drug depending upon how the drug is administered. For example,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Oncovin&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Vial&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Oncovin&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; Syringe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Oncovin&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; Syringe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just want to identify the name once - but I get every line for each drug by mode of delivery as listed in the SAS dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the second problem is just having the name of any drug match listed only once.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for you assistance on this.&lt;/P&gt;&lt;P&gt;Walt Lierman&lt;/P&gt;</description>
    <pubDate>Mon, 20 Apr 2020 23:01:55 GMT</pubDate>
    <dc:creator>wlierman</dc:creator>
    <dc:date>2020-04-20T23:01:55Z</dc:date>
    <item>
      <title>Identifying brand and generic drugs when ther are several generic drugs in a "cocktail mix"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identifying-brand-and-generic-drugs-when-ther-are-several/m-p/641491#M191188</link>
      <description>&lt;P&gt;I have a SAS output data set of drugs prescribed for a Medicaid population.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two issues: 1) setting up a if-then-else section to search for specific hiv/aids drugs by brand and/or generic. The following is the coding. The brand name is mentioned first and the generic is second. Another wrinkle is that there is one brand but (many times) several generics (or more like generic cocktail mix). (There are many lines so I am going to shorten the example. )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data hivaids.hivaids_drugs (keep = DSC_NDC label);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set hal_data.mcaid_drug_dn;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If dsc_ndc eq "Emtriva" or "emtricitabine" then label eq "Yes";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Else If dsc_ndc eq "Delstrigo" or "doravirine" and "lamivudine" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; "tenofovir disoproxil fumarate" then label eq "Yes";&lt;/P&gt;&lt;P&gt;:&lt;/P&gt;&lt;P&gt;:&lt;/P&gt;&lt;P&gt;:&lt;/P&gt;&lt;P&gt;Else If dsc_ndc eq "Kaletra" or "lopinavir" and "ritonavir" then label eq "Yes";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the error I run into is&lt;/P&gt;&lt;P&gt;INVALID numeric data, &amp;lt;&amp;lt; drug name &amp;gt;&amp;gt; at line xxxx column xx&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That error repeats many times.&amp;nbsp; All the drug names on the right hand side of&lt;/P&gt;&lt;P&gt;the&amp;nbsp; OR are the generics and there can be from two to five. I separated each by AND.&lt;/P&gt;&lt;P&gt;I received output which was basically just the column DSC_NDC in the SAS&lt;/P&gt;&lt;P&gt;output set.&amp;nbsp; What I really want is to match the list of hiv/aids drugs against the SAS output set and then only keep those where label = "Yes".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is the first problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Secondly in the SAS output set there may be several lines for the same drug depending upon how the drug is administered. For example,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Oncovin&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Vial&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Oncovin&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; Syringe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Oncovin&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; Syringe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just want to identify the name once - but I get every line for each drug by mode of delivery as listed in the SAS dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the second problem is just having the name of any drug match listed only once.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for you assistance on this.&lt;/P&gt;&lt;P&gt;Walt Lierman&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 23:01:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identifying-brand-and-generic-drugs-when-ther-are-several/m-p/641491#M191188</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2020-04-20T23:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying brand and generic drugs when ther are several generic drugs in a "cocktail mix&amp;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identifying-brand-and-generic-drugs-when-ther-are-several/m-p/641527#M191204</link>
      <description>&lt;P&gt;This invalid syntax:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; If dsc_ndc eq "Emtriva" or "emtricitabine"&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You want:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; If dsc_ndc in ("Emtriva", "emtricitabine" )&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have no idea what this could mean:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;If dsc_ndc eq "Kaletra" or "lopinavir" and "ritonavir"&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&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, 21 Apr 2020 06:16:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identifying-brand-and-generic-drugs-when-ther-are-several/m-p/641527#M191204</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-04-21T06:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying brand and generic drugs when ther are several generic drugs in a "cocktail mix&amp;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identifying-brand-and-generic-drugs-when-ther-are-several/m-p/641557#M191225</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/65907"&gt;@wlierman&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another syntax error is "&lt;FONT face="courier new,courier"&gt;if ...&amp;nbsp;&lt;/FONT&gt;&lt;SPAN&gt;&lt;FONT face="courier new,courier"&gt;then label &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;eq&lt;/FONT&gt;&lt;/STRONG&gt; ...&lt;/FONT&gt;": You cannot replace the equals sign in an assignment statement by the &lt;EM&gt;comparison operator&lt;/EM&gt; &lt;FONT face="courier new,courier"&gt;eq&lt;/FONT&gt;. So it must be&amp;nbsp;"&lt;FONT face="courier new,courier"&gt;if ...&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;then label &lt;FONT size="4" color="#008000"&gt;&lt;STRONG&gt;=&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;...&lt;/FONT&gt;".&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The structure of your code can be simplified:&lt;/P&gt;
&lt;PRE&gt;if &lt;EM&gt;condition1&lt;/EM&gt; then label="Yes";
else if &lt;EM&gt;condition2&lt;/EM&gt; then label="Yes";
...
else if &lt;EM&gt;condition99&lt;/EM&gt; then label="Yes";
&lt;/PRE&gt;
&lt;P&gt;is equivalent to&lt;/P&gt;
&lt;PRE&gt;if &lt;EM&gt;condition1&lt;/EM&gt; or &lt;EM&gt;condition2&lt;/EM&gt; or ... or &lt;EM&gt;condition99&lt;/EM&gt; then label="Yes";&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to &lt;SPAN&gt;keep only those observations where &lt;FONT face="courier new,courier"&gt;label="Yes"&lt;/FONT&gt;, then you may not even need the new variable (&lt;FONT face="courier new,courier"&gt;label&lt;/FONT&gt;) because you can use a &lt;A href="https://documentation.sas.com/?docsetId=lestmtsref&amp;amp;docsetTarget=p1cxl8ifdt8u0gn12wqbji8o5fq1.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank" rel="noopener"&gt;subsetting IF statement&lt;/A&gt;:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;if &lt;EM&gt;condition1&lt;/EM&gt; or &lt;EM&gt;condition2&lt;/EM&gt; or ... or &lt;EM&gt;condition99&lt;/EM&gt;;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The &lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p16rdsa30vmm43n1ej4936nwa01t.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank" rel="noopener"&gt;FINDW function&lt;/A&gt; and other character functions will be helpful in identifying combinations. For example, the IF condition&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;findw(dsc_ndc,'lopinavir',,'ikad') &amp;amp; findw(dsc_ndc,'ritonavir',,'ikad')&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;would be met for &lt;FONT face="courier new,courier"&gt;dsc_ndc&lt;/FONT&gt;&amp;nbsp;values containing the words "lopinavir" and "ritonavir" regardless of upper/lower case (modifier "&lt;FONT face="courier new,courier"&gt;i&lt;/FONT&gt;" in the last argument), treating all characters &lt;EM&gt;except&lt;/EM&gt; (modifier "&lt;FONT face="courier new,courier"&gt;k&lt;/FONT&gt;") &lt;EM&gt;alphabetic characters&lt;/EM&gt; (modifier "&lt;FONT face="courier new,courier"&gt;a&lt;/FONT&gt;") and &lt;EM&gt;digits&lt;/EM&gt; (modifier "&lt;FONT face="courier new,courier"&gt;d&lt;/FONT&gt;") as word delimiters. Examples of matched strings include:&lt;/P&gt;
&lt;PRE&gt;Lopinavir/Ritonavir
LOPINAVIR+RITONAVIR
ritonavir and lopinavir
ritonavir, AZT and lopinavir&lt;/PRE&gt;
&lt;P&gt;Instead of using the modifiers you could also apply FINDW to, e.g., &lt;FONT face="courier new,courier"&gt;lowcase(dsc_ndc)&lt;/FONT&gt;:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;drug=lowcase(dsc_ndc);
if findw(drug,'lopinavir') &amp;amp; findw(drug,'ritonavir') ...;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Unlike the FINDW function, the &lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p00ab6ey29t2i8n1ihel88tqtga9.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank" rel="noopener"&gt;FIND function&lt;/A&gt; would search for substrings and hence find, e.g. &lt;FONT face="courier new,courier"&gt;"amprenavir"&lt;/FONT&gt;&amp;nbsp;in &lt;FONT face="courier new,courier"&gt;"fosamprenavir"&lt;/FONT&gt;&amp;nbsp;-- even though these are different drugs. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;More advanced character functions would be needed to deal with varying spellings or typos in the drug names, if any.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Duplicates can be eliminated in a subsequent step (e.g., PROC SORT with NODUPKEY option) or in the same step (e.g., PROC SQL with&amp;nbsp;&lt;FONT face="courier new,courier"&gt;select &lt;STRONG&gt;distinct&lt;/STRONG&gt;(upcase(dsc_ndc)) from hal_data.mcaid_drug_dn where &lt;EM&gt;condition1&lt;/EM&gt; or &lt;EM&gt;condition2&lt;/EM&gt; or ...&lt;/FONT&gt;). You may want to create a new variable containing the &lt;EM&gt;preferred name&lt;/EM&gt; for the various equivalent verbatim terms so that a NODUPKEY sort by that variable would eliminate duplicates such as "&lt;FONT face="courier new,courier"&gt;Kaletra&lt;/FONT&gt;" and "&lt;FONT face="courier new,courier"&gt;lopinavir+ritonavir&lt;/FONT&gt;".&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 09:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identifying-brand-and-generic-drugs-when-ther-are-several/m-p/641557#M191225</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-04-21T09:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying brand and generic drugs when ther are several generic drugs in a "cocktail mix&amp;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identifying-brand-and-generic-drugs-when-ther-are-several/m-p/641608#M191249</link>
      <description>&lt;P&gt;Richard,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the extensive answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate your time and help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Walt&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 13:42:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identifying-brand-and-generic-drugs-when-ther-are-several/m-p/641608#M191249</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2020-04-21T13:42:32Z</dc:date>
    </item>
  </channel>
</rss>

