<?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 a string of data in a variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Finding-a-string-of-data-in-a-variable/m-p/820289#M323754</link>
    <description>&lt;P&gt;This is the what is in the variable indicators:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Exam matched indicator flag;Signed by Attending;PACS transfer complete;Clinical;EMR transfer complete;Completed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I use the following code it marks this record as 'Educational' and it is not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data qpath_us ;&lt;BR /&gt;retain MRN CSN full_name exam_type date attending signatory institution indicators notes covered_exam discat ;&lt;/P&gt;&lt;P&gt;length discat $10.&lt;BR /&gt;notes $60. ;&lt;BR /&gt;&lt;BR /&gt;set &amp;amp;dsn1 (drop=accession qa_status operator reviewer gender rename=(account=CSN patient_id=MRN)) ;&lt;/P&gt;&lt;P&gt;if CSN ne . ; /*remove temporary ids*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if put (csn,wq9639l.) = '@#%'&lt;BR /&gt;then notes='9639' ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if put (csn,wq9640l.) = '@#%'&lt;BR /&gt;then notes='9640' ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;billing_provider = left(upcase(attending)) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if put(exam_type,$examfmt.) = '1'&lt;BR /&gt;then covered_exam = 'Y' ;&lt;BR /&gt;else covered_exam = 'N' ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if find(exam_type,'Procedural')&lt;BR /&gt;then discat = 'PROC' ;&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;select (exam_type) ;&lt;BR /&gt;when ('ED Abdominal Aorta') discat = 'AORTA';&lt;BR /&gt;when ('ED FAST Exam') discat = 'FAST';&lt;BR /&gt;when ('ED Focused Chest Ultrasound') discat = 'ECHO';&lt;BR /&gt;when ('ED Focused Echo') discat = 'ECHO';&lt;BR /&gt;when ('ED Renal Ultrasound') discat = 'RENAL';&lt;BR /&gt;when ('ED ULTRASOUND EDUCATION') discat = 'EDUCAT' ;&lt;BR /&gt;otherwise discat = 'ALL OTHER';&lt;BR /&gt;end ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;new_indicators = upcase(indicators) ;&lt;/P&gt;&lt;P&gt;if find(new_indicators, "EDUCATIONAL")&lt;BR /&gt;then notes = 'Educational';&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;if exam_type = 'ED ULTRASOUND EDUCATION'&lt;BR /&gt;then notes = 'Educational' ;&lt;/P&gt;&lt;P&gt;else notes=notes ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if notes = 'Educational'&lt;BR /&gt;then covered_exam = 'E' ;&lt;BR /&gt;&lt;BR /&gt;run ;&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;Gina&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jun 2022 17:16:15 GMT</pubDate>
    <dc:creator>gstover</dc:creator>
    <dc:date>2022-06-24T17:16:15Z</dc:date>
    <item>
      <title>Finding a string of data in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-a-string-of-data-in-a-variable/m-p/820149#M323682</link>
      <description>&lt;P&gt;I am trying to find a specific string of data in a variable to set a new variable and am having major issues.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;string_find = find(indicators, "Educational") ;&lt;/P&gt;&lt;P&gt;if string_find ^=0&lt;BR /&gt;then notes='Educational';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is not working.&amp;nbsp; I am going crazy, please help!&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 20:06:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-a-string-of-data-in-a-variable/m-p/820149#M323682</guid>
      <dc:creator>gstover</dc:creator>
      <dc:date>2022-06-23T20:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: Finding a string of data in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-a-string-of-data-in-a-variable/m-p/820155#M323688</link>
      <description>&lt;P&gt;Example data where that is not working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some likely issues: your value is a different case than "Educational" such as "educational" or "EDUCATIONAL" or some different combination of upper and lower case letters. If this is the case then add the option "i" to the Find function symtax to make case insensitive comparison:&lt;/P&gt;
&lt;PRE&gt;string_find = find(indicators, "Educational",'i') ;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 20:30:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-a-string-of-data-in-a-variable/m-p/820155#M323688</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-06-23T20:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Finding a string of data in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-a-string-of-data-in-a-variable/m-p/820184#M323713</link>
      <description>&lt;P&gt;Having the information you provided, it is hardly possible to help (except for the pointing that all compares in sas are case-sensitive, if you don't use options disabling this), so: Please post data in usable form an the complete step you have written to process the data.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 05:29:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-a-string-of-data-in-a-variable/m-p/820184#M323713</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-06-24T05:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: Finding a string of data in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-a-string-of-data-in-a-variable/m-p/820289#M323754</link>
      <description>&lt;P&gt;This is the what is in the variable indicators:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Exam matched indicator flag;Signed by Attending;PACS transfer complete;Clinical;EMR transfer complete;Completed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I use the following code it marks this record as 'Educational' and it is not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data qpath_us ;&lt;BR /&gt;retain MRN CSN full_name exam_type date attending signatory institution indicators notes covered_exam discat ;&lt;/P&gt;&lt;P&gt;length discat $10.&lt;BR /&gt;notes $60. ;&lt;BR /&gt;&lt;BR /&gt;set &amp;amp;dsn1 (drop=accession qa_status operator reviewer gender rename=(account=CSN patient_id=MRN)) ;&lt;/P&gt;&lt;P&gt;if CSN ne . ; /*remove temporary ids*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if put (csn,wq9639l.) = '@#%'&lt;BR /&gt;then notes='9639' ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if put (csn,wq9640l.) = '@#%'&lt;BR /&gt;then notes='9640' ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;billing_provider = left(upcase(attending)) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if put(exam_type,$examfmt.) = '1'&lt;BR /&gt;then covered_exam = 'Y' ;&lt;BR /&gt;else covered_exam = 'N' ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if find(exam_type,'Procedural')&lt;BR /&gt;then discat = 'PROC' ;&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;select (exam_type) ;&lt;BR /&gt;when ('ED Abdominal Aorta') discat = 'AORTA';&lt;BR /&gt;when ('ED FAST Exam') discat = 'FAST';&lt;BR /&gt;when ('ED Focused Chest Ultrasound') discat = 'ECHO';&lt;BR /&gt;when ('ED Focused Echo') discat = 'ECHO';&lt;BR /&gt;when ('ED Renal Ultrasound') discat = 'RENAL';&lt;BR /&gt;when ('ED ULTRASOUND EDUCATION') discat = 'EDUCAT' ;&lt;BR /&gt;otherwise discat = 'ALL OTHER';&lt;BR /&gt;end ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;new_indicators = upcase(indicators) ;&lt;/P&gt;&lt;P&gt;if find(new_indicators, "EDUCATIONAL")&lt;BR /&gt;then notes = 'Educational';&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;if exam_type = 'ED ULTRASOUND EDUCATION'&lt;BR /&gt;then notes = 'Educational' ;&lt;/P&gt;&lt;P&gt;else notes=notes ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if notes = 'Educational'&lt;BR /&gt;then covered_exam = 'E' ;&lt;BR /&gt;&lt;BR /&gt;run ;&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;Gina&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 17:16:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-a-string-of-data-in-a-variable/m-p/820289#M323754</guid>
      <dc:creator>gstover</dc:creator>
      <dc:date>2022-06-24T17:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Finding a string of data in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-a-string-of-data-in-a-variable/m-p/820459#M323837</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/338824"&gt;@gstover&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;This is the what is in the variable indicators:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Exam matched indicator flag;Signed by Attending;PACS transfer complete;Clinical;EMR transfer complete;Completed&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;When I use the following code it marks this record as 'Educational' and it is not.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data qpath_us ;&lt;BR /&gt;retain MRN CSN full_name exam_type date attending signatory institution indicators notes covered_exam discat ;&lt;/P&gt;
&lt;P&gt;length discat $10.&lt;BR /&gt;notes $60. ;&lt;BR /&gt;&lt;BR /&gt;set &amp;amp;dsn1 (drop=accession qa_status operator reviewer gender rename=(account=CSN patient_id=MRN)) ;&lt;/P&gt;
&lt;P&gt;if CSN ne . ; /*remove temporary ids*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if put (csn,wq9639l.) = '@#%'&lt;BR /&gt;then notes='9639' ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if put (csn,wq9640l.) = '@#%'&lt;BR /&gt;then notes='9640' ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;billing_provider = left(upcase(attending)) ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if put(exam_type,$examfmt.) = '1'&lt;BR /&gt;then covered_exam = 'Y' ;&lt;BR /&gt;else covered_exam = 'N' ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if find(exam_type,'Procedural')&lt;BR /&gt;then discat = 'PROC' ;&lt;/P&gt;
&lt;P&gt;else&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;select (exam_type) ;&lt;BR /&gt;when ('ED Abdominal Aorta') discat = 'AORTA';&lt;BR /&gt;when ('ED FAST Exam') discat = 'FAST';&lt;BR /&gt;when ('ED Focused Chest Ultrasound') discat = 'ECHO';&lt;BR /&gt;when ('ED Focused Echo') discat = 'ECHO';&lt;BR /&gt;when ('ED Renal Ultrasound') discat = 'RENAL';&lt;BR /&gt;when ('ED ULTRASOUND EDUCATION') discat = 'EDUCAT' ;&lt;BR /&gt;otherwise discat = 'ALL OTHER';&lt;BR /&gt;end ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF6600"&gt;put 'Starting value ' notes=;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;new_indicators = upcase(indicators) ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if find(new_indicators, "EDUCATIONAL") then &lt;FONT color="#FF6600"&gt;do; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;FONT color="#FF6600"&gt;put 'new_indicators contains educational';&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; notes = 'Educational';&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF6600"&gt;end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;else &lt;FONT color="#FF6600"&gt;do;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if exam_type = 'ED ULTRASOUND EDUCATION' then &lt;FONT color="#FF6600"&gt;do;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF6600"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put 'exam_type is ED ULTRASOUND...';&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; notes = 'Educational' ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;FONT color="#FF6600"&gt;end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; else &lt;FONT color="#FF6600"&gt;do;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF6600"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put 'keeping value of notes';&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; notes=notes ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;FONT color="#FF6600"&gt;end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF6600"&gt;end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if notes = 'Educational'&lt;BR /&gt;then covered_exam = 'E' ;&lt;BR /&gt;&lt;BR /&gt;run ;&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;Gina&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I am not that bored to create dataset &amp;amp;dsn1 and fill it with guessed values. That would not make any sense at all. So until you post an excerpt of the data you have, it is difficult to help. The unformatted code you have posted makes reading it unnecessary difficult, too. You should add do...end to the if statements and add some put-statements, to know which assignment sets "notes" to "Educational". See orange text in your code.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2022 05:25:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-a-string-of-data-in-a-variable/m-p/820459#M323837</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-06-27T05:25:08Z</dc:date>
    </item>
  </channel>
</rss>

