<?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: select all columns with substring Offer via proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/select-all-columns-with-substring-Offer-via-proc-sql/m-p/979009#M378718</link>
    <description>&lt;P&gt;This will get you started. Use the macro variable in your query.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   proc sql;
   select name into: offer_col separated by ','
	   from dictionary.columns
	   where libname = 'WORK' 
		and upcase(memname) = 'HAVE' 
		and upcase(name) contains 'OFFER';
   quit;

   %put &amp;amp;offer_col;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 18 Nov 2025 13:08:21 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2025-11-18T13:08:21Z</dc:date>
    <item>
      <title>select all columns with substring Offer via proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/select-all-columns-with-substring-Offer-via-proc-sql/m-p/979008#M378717</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;LEts say I run proc sql query (I must run it because it is many to many&amp;nbsp; merge that is not working well in data step).&lt;/P&gt;
&lt;P&gt;Please note that in this example I didnt perform merge and just want to select speicifc columns by criteria.&lt;/P&gt;
&lt;P&gt;Let's say that I want to check which columns exist with name "Offer" in the source data set, and then select them in my query.&lt;/P&gt;
&lt;P&gt;What is the way to do it?&lt;/P&gt;
&lt;P&gt;I want to select&amp;nbsp;CustID and all columns have&amp;nbsp; subs tring&amp;nbsp; "offer" and I wan tto do it via proc sql please&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   Data have;
   Input CustID  Offer_Tomato Offer_Banana Milk_offer newspapaer_offer offer_water Firstname $ Year_birth;
   cards;
   111 10 30 20 40 50 Jow 1990
   222 15 25 10 40 18 Yulia 1987
   ;
   Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Nov 2025 13:01:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/select-all-columns-with-substring-Offer-via-proc-sql/m-p/979008#M378717</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-11-18T13:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: select all columns with substring Offer via proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/select-all-columns-with-substring-Offer-via-proc-sql/m-p/979009#M378718</link>
      <description>&lt;P&gt;This will get you started. Use the macro variable in your query.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   proc sql;
   select name into: offer_col separated by ','
	   from dictionary.columns
	   where libname = 'WORK' 
		and upcase(memname) = 'HAVE' 
		and upcase(name) contains 'OFFER';
   quit;

   %put &amp;amp;offer_col;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Nov 2025 13:08:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/select-all-columns-with-substring-Offer-via-proc-sql/m-p/979009#M378718</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2025-11-18T13:08:21Z</dc:date>
    </item>
  </channel>
</rss>

