<?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: Keep Statements - text within a field name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Keep-Statements-text-within-a-field-name/m-p/214491#M39578</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's easy if the fields all start with balance, then you can use balance:&lt;/P&gt;&lt;P&gt;Otherwise you have to pull the variable names from the dictionary tables and create a macro variable to include in your keep statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;select name into :balance_list separated by " "&lt;/P&gt;&lt;P&gt;from sashelp.vcolumn &lt;/P&gt;&lt;P&gt;where upper(libname)='WORK' and upper(memname)='MY_DATA' and upper(name) like '%BALANCE%';&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;keep &amp;amp;balance_list;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Apr 2015 19:41:12 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-04-01T19:41:12Z</dc:date>
    <item>
      <title>Keep Statements - text within a field name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-Statements-text-within-a-field-name/m-p/214490#M39577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to modify the keep statement to ensure all field names containing a certain text are output? For example, I have many different balance fields in a dataset which are not part of an array and I would like to keep all fields containing the text 'balance'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2015 19:33:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-Statements-text-within-a-field-name/m-p/214490#M39577</guid>
      <dc:creator>SeandJ</dc:creator>
      <dc:date>2015-04-01T19:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Keep Statements - text within a field name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-Statements-text-within-a-field-name/m-p/214491#M39578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's easy if the fields all start with balance, then you can use balance:&lt;/P&gt;&lt;P&gt;Otherwise you have to pull the variable names from the dictionary tables and create a macro variable to include in your keep statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;select name into :balance_list separated by " "&lt;/P&gt;&lt;P&gt;from sashelp.vcolumn &lt;/P&gt;&lt;P&gt;where upper(libname)='WORK' and upper(memname)='MY_DATA' and upper(name) like '%BALANCE%';&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;keep &amp;amp;balance_list;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2015 19:41:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-Statements-text-within-a-field-name/m-p/214491#M39578</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-04-01T19:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: Keep Statements - text within a field name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-Statements-text-within-a-field-name/m-p/214492#M39579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This works very well thanks. On a side point, why do you use the 'upper' function for the column names when the fields are in uppercase already?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Apr 2015 11:25:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-Statements-text-within-a-field-name/m-p/214492#M39579</guid>
      <dc:creator>SeandJ</dc:creator>
      <dc:date>2015-04-06T11:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Keep Statements - text within a field name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-Statements-text-within-a-field-name/m-p/214493#M39580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;They may be upper cased in your situation but they're not always upper case.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Apr 2015 15:58:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-Statements-text-within-a-field-name/m-p/214493#M39580</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-04-06T15:58:16Z</dc:date>
    </item>
  </channel>
</rss>

