<?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: selecting codes within a range from 25 columns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/selecting-codes-within-a-range-from-25-columns/m-p/513994#M138567</link>
    <description>Do those mappings, which code goes to which group, exist in a data set somewhere? Or is on paper or in your head? If you put it into a dataset, a format is likely your best option.</description>
    <pubDate>Fri, 16 Nov 2018 17:40:33 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-11-16T17:40:33Z</dc:date>
    <item>
      <title>selecting codes within a range from 25 columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/selecting-codes-within-a-range-from-25-columns/m-p/513561#M138373</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;I have 25 variables with codes (some are missing) and would like to&amp;nbsp;create new columns/variables within specific code range. For example the last column "DiseaseIwant" in the attached "test.xlsx"&amp;nbsp; file has an entry "Yes" because at least one of the 25 columns was coded within the range that I selected, in this case from E10 to E14. (record 4 of Column15 is E102 and is highlighted in yellow therefore "DiseaseIwant" was entered "Yes" for record 4.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;could you please help me with the SAS code to get column "DiseaseIwant"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 20:09:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/selecting-codes-within-a-range-from-25-columns/m-p/513561#M138373</guid>
      <dc:creator>lalohg</dc:creator>
      <dc:date>2018-11-15T20:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: selecting codes within a range from 25 columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/selecting-codes-within-a-range-from-25-columns/m-p/513567#M138375</link>
      <description>Is E10-E14 your full list?&lt;BR /&gt;Or can that change? I'm assumign that anything STARTING with E10, E11, E12, E13, E14 would be valid, such as E105.4 or E140.8</description>
      <pubDate>Thu, 15 Nov 2018 20:15:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/selecting-codes-within-a-range-from-25-columns/m-p/513567#M138375</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-15T20:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: selecting codes within a range from 25 columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/selecting-codes-within-a-range-from-25-columns/m-p/513621#M138400</link>
      <description>&lt;P&gt;Would you prefer to define a list of diseases instead of a range, just because your codes are alphanumeric,&lt;/P&gt;
&lt;P&gt;then you can try next code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let codes = E10 E11 E12 ..... ;

data want;
  set have;
        array dx $ disease: ;
        do i=1 to dim(dx);
             if findw("&amp;amp;codes" , dx(i)) &amp;gt; 0 then DiseaseIwant = 'Yes;
             else DiseaseIwant = 'No';
        end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Nov 2018 21:10:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/selecting-codes-within-a-range-from-25-columns/m-p/513621#M138400</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-11-15T21:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: selecting codes within a range from 25 columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/selecting-codes-within-a-range-from-25-columns/m-p/513622#M138401</link>
      <description>&lt;P&gt;Character comparisons in general do not work very well with a "range" of values such a &amp;lt; E14.&lt;/P&gt;
&lt;P&gt;You should really provide a complete list of exact values that are the range. Also are you looking for a single similar set of values or do you have a large number? For example could your DiseaseIwant ,or some other&amp;nbsp;varialble,&amp;nbsp;also need some values that start with K, Q and Z?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 21:11:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/selecting-codes-within-a-range-from-25-columns/m-p/513622#M138401</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-11-15T21:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: selecting codes within a range from 25 columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/selecting-codes-within-a-range-from-25-columns/m-p/513991#M138564</link>
      <description>&lt;P&gt;Thanks for your answer Ballardw,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes!, I need to create new variables from alphanumeric codes starting from A to Z but each new variable within a range, for&amp;nbsp;&lt;SPAN&gt;example one new variable will have codes from "C00" to "C979",&amp;nbsp;another one from "C250" to "C254" another column&amp;nbsp; from "E10" to "E14", another column with just "E11" and so on...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;some codes in the xlsx table that I attached&amp;nbsp; have 3 or 4 characters, this was a mistake, all should have 4 characters, sorry about this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I just found out that some &lt;SPAN&gt;of the 25 columns in the data sets&amp;nbsp;&lt;/SPAN&gt;(each data set with more tha 500,000 rows) where the new variables will be created from have more than one code (up to 5 or 6 codes) so will need a code to scan these extra codes in each of the 25 columns,&lt;/P&gt;
&lt;P&gt;It "sounds" complicated and wonder if this can be done?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you very much.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lalohg&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 17:31:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/selecting-codes-within-a-range-from-25-columns/m-p/513991#M138564</guid>
      <dc:creator>lalohg</dc:creator>
      <dc:date>2018-11-16T17:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: selecting codes within a range from 25 columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/selecting-codes-within-a-range-from-25-columns/m-p/513994#M138567</link>
      <description>Do those mappings, which code goes to which group, exist in a data set somewhere? Or is on paper or in your head? If you put it into a dataset, a format is likely your best option.</description>
      <pubDate>Fri, 16 Nov 2018 17:40:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/selecting-codes-within-a-range-from-25-columns/m-p/513994#M138567</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-16T17:40:33Z</dc:date>
    </item>
  </channel>
</rss>

