<?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 Using SCAN function to identify and extract character strings after delimiter in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Using-SCAN-function-to-identify-and-extract-character-strings/m-p/619206#M19351</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to extract qualitative responses after encountering a comma, following Yes/No responses and create two variables, one containing yes/no responses, and the other containing qualitative responses.&amp;nbsp; Below is an example of the data as it is now, and what I would like.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data as it is now:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID &amp;nbsp; &amp;nbsp; Var1&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp;&amp;nbsp; Yes. The training was great!&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp;&amp;nbsp; No, it was not helpful.&lt;/P&gt;&lt;P&gt;3 &amp;nbsp; &amp;nbsp;&amp;nbsp; Yes&lt;/P&gt;&lt;P&gt;4 &amp;nbsp; &amp;nbsp;&amp;nbsp; YES, the part about patient-centered counseling&lt;/P&gt;&lt;P&gt;5 &amp;nbsp; &amp;nbsp; &amp;nbsp; No, see my previous comment&lt;/P&gt;&lt;P&gt;6 &amp;nbsp; &amp;nbsp; &amp;nbsp; Yes, Amber was wonderful!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I would like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID &amp;nbsp;&amp;nbsp; Var1 &amp;nbsp; &amp;nbsp;&amp;nbsp; Var2&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp;&amp;nbsp; Yes &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;The training was great!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;2&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;No &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;it was not helpful.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;3&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Yes&lt;/P&gt;&lt;P&gt;4&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Yes &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; t&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;he part about patient-centered counseling&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;5&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;No &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; see my previous comment&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;6&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Yes &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Amber was wonderful!!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Most observations have Yes/No only, or are blank.&amp;nbsp; Only about 10% have qualitative responses included.&amp;nbsp; This was a data entry error on the part of student assistants, but it occurs fairly often across different datasets and variables. I have used the SCAN function to identify observations that need modification, but would appreciate help creating a new variable to take the qualitative value (maintaining case and punctuation as it appears).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data want;
   set have;
   if scan(upcase(VAR1,1)) in ('YES','NO') then VAR2 = 'Modify';
   /*I used VAR2 as a test to see if my use of the SCAN function worked to identify observations needing modification*/
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;I would like help assigning the qualitative values to VAR2 as they appear after the comma in VAR1, stripping the leading space, and leaving VAR1 with only the vale of Yes/No.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jan 2020 16:18:00 GMT</pubDate>
    <dc:creator>LEINAARE</dc:creator>
    <dc:date>2020-01-22T16:18:00Z</dc:date>
    <item>
      <title>Using SCAN function to identify and extract character strings after delimiter</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Using-SCAN-function-to-identify-and-extract-character-strings/m-p/619206#M19351</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to extract qualitative responses after encountering a comma, following Yes/No responses and create two variables, one containing yes/no responses, and the other containing qualitative responses.&amp;nbsp; Below is an example of the data as it is now, and what I would like.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data as it is now:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID &amp;nbsp; &amp;nbsp; Var1&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp;&amp;nbsp; Yes. The training was great!&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp;&amp;nbsp; No, it was not helpful.&lt;/P&gt;&lt;P&gt;3 &amp;nbsp; &amp;nbsp;&amp;nbsp; Yes&lt;/P&gt;&lt;P&gt;4 &amp;nbsp; &amp;nbsp;&amp;nbsp; YES, the part about patient-centered counseling&lt;/P&gt;&lt;P&gt;5 &amp;nbsp; &amp;nbsp; &amp;nbsp; No, see my previous comment&lt;/P&gt;&lt;P&gt;6 &amp;nbsp; &amp;nbsp; &amp;nbsp; Yes, Amber was wonderful!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I would like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID &amp;nbsp;&amp;nbsp; Var1 &amp;nbsp; &amp;nbsp;&amp;nbsp; Var2&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp;&amp;nbsp; Yes &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;The training was great!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;2&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;No &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;it was not helpful.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;3&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Yes&lt;/P&gt;&lt;P&gt;4&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Yes &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; t&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;he part about patient-centered counseling&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;5&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;No &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; see my previous comment&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;6&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Yes &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Amber was wonderful!!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Most observations have Yes/No only, or are blank.&amp;nbsp; Only about 10% have qualitative responses included.&amp;nbsp; This was a data entry error on the part of student assistants, but it occurs fairly often across different datasets and variables. I have used the SCAN function to identify observations that need modification, but would appreciate help creating a new variable to take the qualitative value (maintaining case and punctuation as it appears).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data want;
   set have;
   if scan(upcase(VAR1,1)) in ('YES','NO') then VAR2 = 'Modify';
   /*I used VAR2 as a test to see if my use of the SCAN function worked to identify observations needing modification*/
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;I would like help assigning the qualitative values to VAR2 as they appear after the comma in VAR1, stripping the leading space, and leaving VAR1 with only the vale of Yes/No.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 16:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Using-SCAN-function-to-identify-and-extract-character-strings/m-p/619206#M19351</guid>
      <dc:creator>LEINAARE</dc:creator>
      <dc:date>2020-01-22T16:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using SCAN function to identify and extract character strings after delimiter</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Using-SCAN-function-to-identify-and-extract-character-strings/m-p/619219#M19353</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
if countw(var1,' .,') &amp;gt; 1
then do;
  index = indexc(var1,' ,.');
  var2 = substr(var1,index+1);
  var1 = substr(var1,1,index-1);
end;
else if upcase(var1) in ('YES','NO') then var2 = 'Modify';
drop index;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Jan 2020 16:38:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Using-SCAN-function-to-identify-and-extract-character-strings/m-p/619219#M19353</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-22T16:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using SCAN function to identify and extract character strings after delimiter</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Using-SCAN-function-to-identify-and-extract-character-strings/m-p/619226#M19354</link>
      <description>&lt;P&gt;Use the INDEXW function to find the character position where the second word in VAR1 resides.&amp;nbsp; Then use that as the starting position in a SUBSTR function, as in:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID     oldVar1 :&amp;amp;$30.;
datalines;
1      Yes. The training was great!
2      No, it was not helpful.
3      Yes
4      YES, the part about patient-centered counseling
5      No, see my previous comment
6      Yes, Amber was wonderful!!!
run;

data want;
  set have;
  var1=scan(oldvar1,1);
  c=indexw(oldvar1,scan(oldvar1,2));
  if c&amp;gt;0 then var2=substr(oldvar1,c);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The leading "&amp;amp;" in the informat used in the INPUT statement tells sas not to allow a single blank to terminate the incoming character value (but a double blanks would terminate it).&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 16:51:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Using-SCAN-function-to-identify-and-extract-character-strings/m-p/619226#M19354</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-01-22T16:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using SCAN function to identify and extract character strings after delimiter</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Using-SCAN-function-to-identify-and-extract-character-strings/m-p/619234#M19355</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; &amp;amp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code that both of you sent worked to solve the issue.&amp;nbsp; I accepted&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; because he posted his solution first.&amp;nbsp; Thank you both again.&amp;nbsp; This will give me some new code to experiment with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ted&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 17:06:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Using-SCAN-function-to-identify-and-extract-character-strings/m-p/619234#M19355</guid>
      <dc:creator>LEINAARE</dc:creator>
      <dc:date>2020-01-22T17:06:31Z</dc:date>
    </item>
  </channel>
</rss>

