<?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 Proc SQL, how to determine which column to use in where clause based on user value entered in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-Proc-SQL-how-to-determine-which-column-to-use-in-where/m-p/252515#M47962</link>
    <description>&lt;P&gt;Thanks so much for your assistance!&lt;/P&gt;</description>
    <pubDate>Thu, 25 Feb 2016 19:40:20 GMT</pubDate>
    <dc:creator>ncsthbell</dc:creator>
    <dc:date>2016-02-25T19:40:20Z</dc:date>
    <item>
      <title>Using Proc SQL, how to determine which column to use in where clause based on user value entered?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Proc-SQL-how-to-determine-which-column-to-use-in-where/m-p/250136#M47144</link>
      <description>&lt;P&gt;I have defined one prompt named ‘whichcolumn’.&amp;nbsp; Based on the length of the value the user enters into the prompt I need to determine which column to use in my ‘where’ clause.&lt;/P&gt;
&lt;P&gt;Is this possible to build as part of a where clause? If not, are there any other suggestions as to how I can accomplish this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My table columns:&lt;/P&gt;
&lt;P&gt;Column2 Column2Desc &amp;nbsp;Column3 &amp;nbsp;Column3Desc&amp;nbsp; Column4 Column4Desc&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;If the user enters ‘72’, &amp;nbsp;&amp;nbsp;&amp;nbsp;the length is 2 so I want to use Column2 in my where clause.&lt;/P&gt;
&lt;P&gt;If the user enters ‘721’,&amp;nbsp; &amp;nbsp;the length is 3 so I want to use Column3 in my where clause.&lt;/P&gt;
&lt;P&gt;If the user enters ‘7211’, the length is 4 so I want to use Column4 in my where clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for any assistance!&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 18:05:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Proc-SQL-how-to-determine-which-column-to-use-in-where/m-p/250136#M47144</guid>
      <dc:creator>ncsthbell</dc:creator>
      <dc:date>2016-02-15T18:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using Proc SQL, how to determine which column to use in where clause based on user value entered</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Proc-SQL-how-to-determine-which-column-to-use-in-where/m-p/250138#M47145</link>
      <description>&lt;P&gt;Since you mentioned 'prompt', this question maybe more suitable for Enterprise Guide sub-forum, where you are more likely to get help from EG experts. &amp;nbsp;Something along the line of following simple implementation may work for you, try it in your stored process. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
%let var=column%length(&amp;amp;seq); /*assume seq is your prompt name*/

proc sql;
select blah blah from blah where &amp;amp;var blah
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Of course you can use it as a compound one step in your Proc SQL, I was trying to set up the flow chart for you, in case you need more flexibility.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 18:22:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Proc-SQL-how-to-determine-which-column-to-use-in-where/m-p/250138#M47145</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-02-15T18:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using Proc SQL, how to determine which column to use in where clause based on user value entered</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Proc-SQL-how-to-determine-which-column-to-use-in-where/m-p/252515#M47962</link>
      <description>&lt;P&gt;Thanks so much for your assistance!&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 19:40:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Proc-SQL-how-to-determine-which-column-to-use-in-where/m-p/252515#M47962</guid>
      <dc:creator>ncsthbell</dc:creator>
      <dc:date>2016-02-25T19:40:20Z</dc:date>
    </item>
  </channel>
</rss>

