<?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: How to run a condition with LIKE or CONTAINS, or do similar things? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-run-a-condition-with-LIKE-or-CONTAINS-or-do-similar/m-p/517787#M3417</link>
    <description>&lt;P&gt;If you define a variable as character with a length of 5, and then attempt to store a number in it, do you have any idea of what the result will be?&lt;/P&gt;</description>
    <pubDate>Sun, 02 Dec 2018 00:56:23 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-12-02T00:56:23Z</dc:date>
    <item>
      <title>How to run a condition with LIKE or CONTAINS, or do similar things?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-run-a-condition-with-LIKE-or-CONTAINS-or-do-similar/m-p/517784#M3414</link>
      <description>&lt;P&gt;I have rows of news which I need to give codes to based on individuals in the news. I am trying to do the following thing:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data zzz;&lt;/P&gt;&lt;P&gt;set yyy;&lt;/P&gt;&lt;P&gt;if there is "% Bernanke%" in Event, then there is a new column SF1=1; else SF1=0;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if there is &lt;/SPAN&gt;&lt;SPAN&gt;"% Rosengren&lt;/SPAN&gt;&lt;SPAN&gt;%" in Event, then there is a new column SF2=1; else SF2=0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if there is "% Paulson%" in Event, then there is a new column SF3=1; else SF3=0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;… … … … … … … …&amp;nbsp;… … … … … … … …&amp;nbsp;… … … … … … … …&amp;nbsp;… … … … …&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Also, I would like to set the length of the new variables (columns) SF1, SF2, SF3... to $5. How can I set the length for all the new columns at the beginning except writing: length SF1 $5.; for each new variable?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Dec 2018 00:20:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-run-a-condition-with-LIKE-or-CONTAINS-or-do-similar/m-p/517784#M3414</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2018-12-02T00:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a condition with LIKE or CONTAINS, or do similar things?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-run-a-condition-with-LIKE-or-CONTAINS-or-do-similar/m-p/517785#M3415</link>
      <description>&lt;P&gt;To reference multiple variables with the same prefix and a numeric suffix you can use a hyphen as in the example below. You can also use the find function to search a string for a substring.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example using the SASHELP.CARS data set&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data out;
	length sf1-sf3 $5;
	set sashelp.cars;
	if find(model,"convertible") then sf1=1;
		else sf1=0;
	if find(model,"manual") then sf2=1;
		else sf2=0;
	if find(model,"auto") then sf3=1;
		else sf3=0;	
run;
	&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Dec 2018 00:48:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-run-a-condition-with-LIKE-or-CONTAINS-or-do-similar/m-p/517785#M3415</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2018-12-02T00:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a condition with LIKE or CONTAINS, or do similar things?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-run-a-condition-with-LIKE-or-CONTAINS-or-do-similar/m-p/517787#M3417</link>
      <description>&lt;P&gt;If you define a variable as character with a length of 5, and then attempt to store a number in it, do you have any idea of what the result will be?&lt;/P&gt;</description>
      <pubDate>Sun, 02 Dec 2018 00:56:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-run-a-condition-with-LIKE-or-CONTAINS-or-do-similar/m-p/517787#M3417</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-12-02T00:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a condition with LIKE or CONTAINS, or do similar things?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-run-a-condition-with-LIKE-or-CONTAINS-or-do-similar/m-p/517790#M3419</link>
      <description>So stupid of me! I realized my mistake. Thank you &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;</description>
      <pubDate>Sun, 02 Dec 2018 01:46:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-run-a-condition-with-LIKE-or-CONTAINS-or-do-similar/m-p/517790#M3419</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2018-12-02T01:46:37Z</dc:date>
    </item>
  </channel>
</rss>

