<?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: Find the string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794438#M254737</link>
    <description>&lt;P&gt;Looks like your multiple cars are nicely separated by commas. So this may work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  do _N_=1 by 1;
    car=scan(cars,_N_,',');
    if car=' ' then leave;
    output;
    end;
  drop cars;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 04 Feb 2022 10:26:06 GMT</pubDate>
    <dc:creator>s_lassen</dc:creator>
    <dc:date>2022-02-04T10:26:06Z</dc:date>
    <item>
      <title>Find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794372#M254715</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;
&lt;P&gt;I have a variable &lt;STRONG&gt;cars&lt;/STRONG&gt; which has 4 different values. Some records have multiple values in it(the dataset looks like one row by showroom). I want to create a dataset with multiple records where I want to search for the a particular string value and give it one row each(dataset looks like it has multiple records by showroom).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RAVI2000_1-1643931564517.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68186i35173E76EFF7FAA0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RAVI2000_1-1643931564517.png" alt="RAVI2000_1-1643931564517.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I tried using Index, but didn't give the desired result.&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;</description>
      <pubDate>Thu, 03 Feb 2022 23:42:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794372#M254715</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2022-02-03T23:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794386#M254720</link>
      <description>Can you show what you tried with index?</description>
      <pubDate>Fri, 04 Feb 2022 02:37:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794386#M254720</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-02-04T02:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794389#M254721</link>
      <description>How do I divide the values for one showroom and put them into rows?&lt;BR /&gt;The Index really does't really helped.</description>
      <pubDate>Fri, 04 Feb 2022 04:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794389#M254721</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2022-02-04T04:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794394#M254725</link>
      <description>&lt;P&gt;Here's a similar question, the answer is essentially the same except you have a different delimiter.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Split-mixture-of-strings-separated-by-multiple-different/m-p/513303" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/Split-mixture-of-strings-separated-by-multiple-different/m-p/513303&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A more complex one:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/re-Separate-String-into-seaparate-variables/m-p/772824" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/re-Separate-String-into-seaparate-variables/m-p/772824&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And one more:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Creating-dummy-variables-from-variables-with-multiple-character/m-p/551781" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Creating-dummy-variables-from-variables-with-multiple-character/m-p/551781&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Feb 2022 04:56:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794394#M254725</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-02-04T04:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: Find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794396#M254726</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data PD3;
	set PD2;
	
	if cars ne "" and index(compress(lowcase(cars)),"audionroad") then flag1 = "Audi on road";
	if cars ne "" and index(compress(lowcase(cars)),"benzonroad")then flag2 = "Benz on road";
	if cars ne "" and index(compress(lowcase(cars)),"hondaonroad") then flag3 = "Honda on road";
	if cars ne "" and index(compress(lowcase(cars)),"fordonroad") then flag4 = "Ford on road";
	if cars ne "" and index(compress(lowcase(cars)),"porche") then flag5 = "Porche";
	
run;

data PD4;
	group = 'A';
	do until(done1);
		set PD3(rename=(flag1=flag)) end=done1;
		output;
	end;
	
	group = 'B';
	do until(done2);
		set PD3(rename=(flag2 = flag)) end=done2;
		output;
	end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It is not giving what I want.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Feb 2022 05:16:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794396#M254726</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2022-02-04T05:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794406#M254727</link>
      <description>&lt;P&gt;If the screenshot shows what you want, then you need only one flag variable and use the output statement in each if.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if cars ne "" and index(compress(lowcase(cars)),"audionroad") then do;
  flag = "Audi on road";
  output;
end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Feb 2022 06:42:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794406#M254727</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-02-04T06:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794408#M254728</link>
      <description>&lt;P&gt;Have you read the links posted by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; ? The first one suggest a solution, so have a look at the documentation of the function countw and scan and the output statement, all combined with a loop solves your problem.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Feb 2022 06:50:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794408#M254728</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-02-04T06:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: Find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794409#M254729</link>
      <description>&lt;P&gt;Have you read the links posted by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; ? The first one suggest a solution, so have a look at the documentation of the function countw and scan and the output statement. Used within a loop, your task can be solved in a single step.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Feb 2022 06:51:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794409#M254729</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-02-04T06:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: Find the string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794438#M254737</link>
      <description>&lt;P&gt;Looks like your multiple cars are nicely separated by commas. So this may work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  do _N_=1 by 1;
    car=scan(cars,_N_,',');
    if car=' ' then leave;
    output;
    end;
  drop cars;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Feb 2022 10:26:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-string/m-p/794438#M254737</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2022-02-04T10:26:06Z</dc:date>
    </item>
  </channel>
</rss>

