<?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 Want to compress code with multiple conditions in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Want-to-compress-code-with-multiple-conditions/m-p/939102#M45125</link>
    <description>&lt;P&gt;Hello I use SAS EG and I'm wondering if there is a way to compress this kind of code, so I don't have to write 100 rows.&amp;nbsp; If Columns 1 to 100 are together in the data, then if you wanted to keep those columns you could do keep Column1--Column100, is there something similar you could do here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if Column1 = X and&lt;/P&gt;&lt;P&gt;Column2 = X and&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Coloumn100 = X&lt;/P&gt;&lt;P&gt;then do Y&lt;/P&gt;</description>
    <pubDate>Tue, 13 Aug 2024 18:16:05 GMT</pubDate>
    <dc:creator>apjohnson2</dc:creator>
    <dc:date>2024-08-13T18:16:05Z</dc:date>
    <item>
      <title>Want to compress code with multiple conditions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Want-to-compress-code-with-multiple-conditions/m-p/939102#M45125</link>
      <description>&lt;P&gt;Hello I use SAS EG and I'm wondering if there is a way to compress this kind of code, so I don't have to write 100 rows.&amp;nbsp; If Columns 1 to 100 are together in the data, then if you wanted to keep those columns you could do keep Column1--Column100, is there something similar you could do here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if Column1 = X and&lt;/P&gt;&lt;P&gt;Column2 = X and&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Coloumn100 = X&lt;/P&gt;&lt;P&gt;then do Y&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 18:16:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Want-to-compress-code-with-multiple-conditions/m-p/939102#M45125</guid>
      <dc:creator>apjohnson2</dc:creator>
      <dc:date>2024-08-13T18:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Want to compress code with multiple conditions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Want-to-compress-code-with-multiple-conditions/m-p/939108#M45127</link>
      <description>&lt;P&gt;Checking for clarification ... do you want to find one (or more) of COLUMN1-COLUMN100 which has the value 'X', or do ALL columns have to have value 'X'???&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 18:26:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Want-to-compress-code-with-multiple-conditions/m-p/939108#M45127</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-08-13T18:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: Want to compress code with multiple conditions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Want-to-compress-code-with-multiple-conditions/m-p/939109#M45128</link>
      <description>&lt;P&gt;I'm curious about either.&amp;nbsp; Also I would like to know how to check if many columns are missing or not missing, both for character and numeric.&amp;nbsp; I know this is a lot, but the case I'm most interested in at the moment is checking something like this, for numeric variables, where if at least one field is not missing, then do X&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if not(&lt;/P&gt;&lt;P&gt;Column1 = .&lt;/P&gt;&lt;P&gt;and Column2 = .&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;and Column100 = .)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then do X&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 18:38:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Want-to-compress-code-with-multiple-conditions/m-p/939109#M45128</guid>
      <dc:creator>apjohnson2</dc:creator>
      <dc:date>2024-08-13T18:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: Want to compress code with multiple conditions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Want-to-compress-code-with-multiple-conditions/m-p/939110#M45129</link>
      <description>&lt;P&gt;Find if all columns are the value 'X'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;string=(cat(of column1-column100));
if findc(trim(string),'X','k')=0 then ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Find if one (or more) of the columns have the value 'X'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if whichc('X',of column1-column100)&amp;gt;0 then ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the variables are numeric, then you would use the WHICHN function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The columns do not have to be together, but all 100 must be exist.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 18:52:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Want-to-compress-code-with-multiple-conditions/m-p/939110#M45129</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-08-13T18:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Want to compress code with multiple conditions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Want-to-compress-code-with-multiple-conditions/m-p/939112#M45130</link>
      <description>&lt;P&gt;Thanks!&amp;nbsp; Do you know how to check if they are missing or not missing, instead of being equal to value X?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 18:59:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Want-to-compress-code-with-multiple-conditions/m-p/939112#M45130</guid>
      <dc:creator>apjohnson2</dc:creator>
      <dc:date>2024-08-13T18:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Want to compress code with multiple conditions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Want-to-compress-code-with-multiple-conditions/m-p/939117#M45131</link>
      <description>&lt;P&gt;Use '.' instead of 'X' in FINDC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use . instead of 'X' in WHICHN&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 19:11:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Want-to-compress-code-with-multiple-conditions/m-p/939117#M45131</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-08-13T19:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: Want to compress code with multiple conditions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Want-to-compress-code-with-multiple-conditions/m-p/939118#M45132</link>
      <description>&lt;P&gt;Thanks!&amp;nbsp; One more question, if I have a long list of columns that are not numbered, but are together in the data, is there a way to use the "--" functionality somehow?&amp;nbsp; For example I would like to compress the following code, where the columns BI through Roof are together in the data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;select distinct Variable into: varlist separated by ' ' from factor.vehfactor_RAD7MM&lt;BR /&gt;where CustomerGroup in ('ABM','AFF','RV')&lt;BR /&gt;and Variable not in ('SymbolLiab','SymbolPhy','AgeSymDed','VehHisCodeNew','IRM'&lt;BR /&gt;,'NewBusDisc','SRMCode_v41','SR_Group', 'TerritoryNew'&lt;BR /&gt;)&lt;BR /&gt;and not (BI = . and&lt;BR /&gt;PD = . and&lt;BR /&gt;MED = . and&lt;BR /&gt;UMBI = . and&lt;BR /&gt;UMPD = . and&lt;BR /&gt;COMP = . and&lt;BR /&gt;COLL = . and&lt;BR /&gt;PERS = . and&lt;BR /&gt;FTBI = . and&lt;BR /&gt;RENT = . and&lt;BR /&gt;TOW = . and&lt;BR /&gt;CUST = . and&lt;BR /&gt;AAE = . and&lt;BR /&gt;ADD = . and&lt;BR /&gt;DimDed = . and&lt;BR /&gt;RVVL = . and&lt;BR /&gt;RVMX = . and&lt;BR /&gt;PPMX = . and&lt;BR /&gt;RVEE = . and&lt;BR /&gt;RVConsign = . and&lt;BR /&gt;Pest = . and&lt;BR /&gt;Roof = .&lt;BR /&gt;)&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 19:18:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Want-to-compress-code-with-multiple-conditions/m-p/939118#M45132</guid>
      <dc:creator>apjohnson2</dc:creator>
      <dc:date>2024-08-13T19:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Want to compress code with multiple conditions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Want-to-compress-code-with-multiple-conditions/m-p/939132#M45133</link>
      <description>&lt;P&gt;Please give it a try and see what happens.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 20:12:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Want-to-compress-code-with-multiple-conditions/m-p/939132#M45133</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-08-13T20:12:36Z</dc:date>
    </item>
  </channel>
</rss>

