<?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: using findw find a value and populate a new variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/using-findw-find-a-value-and-populate-a-new-variable/m-p/422913#M103984</link>
    <description>&lt;P&gt;There are some very good reasons to code Yes/no as numeric 1/0 values.&lt;/P&gt;
&lt;P&gt;One is that when asking to compare if value='Y' you might have set some values to lower case y or even spelled it out 'yes' or 'Yes' depending. And then you get into a look at data to check the values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second you can always have a custom format to display Yes/No, Y/N, T/F, True/False, Member/Not member or any pair of values without having to change the variable coding.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Third in summary and report procedures a SUM of the variable will give you count of Yes values and Mean is a percent of Yes values. This may not sound like much but generate a table with Number of Yes and Percent Yes that match your expectations with 'Yes' valued variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Fourth some modeling procedures may require a numeric variable.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Dec 2017 23:46:52 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-12-20T23:46:52Z</dc:date>
    <item>
      <title>using findw find a value and populate a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-findw-find-a-value-and-populate-a-new-variable/m-p/422908#M103982</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a value of string variable :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AESOUT&lt;/P&gt;
&lt;P&gt;3::4&amp;nbsp; (this is the value of variable AESOUT)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need other variables to populate with 'Y' if contains a 3 or a 4&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if findw(aesout,'3')&amp;gt;0 then AESHOSP='Y';&lt;BR /&gt; else AESHOSP='';&lt;/P&gt;
&lt;P&gt;if findw(aesout,'4')&amp;gt;0 then AESDISAB='Y';&lt;BR /&gt; else AESDISAB='';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...However I am getting null values in the new variables&amp;nbsp;(AESHOSP and AESDISAB) where I am expecting a 'Y'.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Help is appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2017 23:20:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-findw-find-a-value-and-populate-a-new-variable/m-p/422908#M103982</guid>
      <dc:creator>jenim514</dc:creator>
      <dc:date>2017-12-20T23:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: using findw find a value and populate a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-findw-find-a-value-and-populate-a-new-variable/m-p/422910#M103983</link>
      <description>&lt;P&gt;try index&lt;/P&gt;&lt;P&gt;data h;&lt;BR /&gt;s="3::4";&lt;BR /&gt;if index(s,'3')&amp;gt;0 then new_var='yes';&lt;BR /&gt;if index(s,'4')&amp;gt;0 then new_var1='yes';&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2017 23:25:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-findw-find-a-value-and-populate-a-new-variable/m-p/422910#M103983</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-12-20T23:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: using findw find a value and populate a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-findw-find-a-value-and-populate-a-new-variable/m-p/422913#M103984</link>
      <description>&lt;P&gt;There are some very good reasons to code Yes/no as numeric 1/0 values.&lt;/P&gt;
&lt;P&gt;One is that when asking to compare if value='Y' you might have set some values to lower case y or even spelled it out 'yes' or 'Yes' depending. And then you get into a look at data to check the values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second you can always have a custom format to display Yes/No, Y/N, T/F, True/False, Member/Not member or any pair of values without having to change the variable coding.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Third in summary and report procedures a SUM of the variable will give you count of Yes values and Mean is a percent of Yes values. This may not sound like much but generate a table with Number of Yes and Percent Yes that match your expectations with 'Yes' valued variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Fourth some modeling procedures may require a numeric variable.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2017 23:46:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-findw-find-a-value-and-populate-a-new-variable/m-p/422913#M103984</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-12-20T23:46:52Z</dc:date>
    </item>
  </channel>
</rss>

