<?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 variables with a KEEP statement and a prompt in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Select-variables-with-a-KEEP-statement-and-a-prompt/m-p/130051#M26550</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Astounding ! It will make it better !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sincerely&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Sep 2013 16:23:04 GMT</pubDate>
    <dc:creator>GuiVtzl</dc:creator>
    <dc:date>2013-09-05T16:23:04Z</dc:date>
    <item>
      <title>Select variables with a KEEP statement and a prompt</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-variables-with-a-KEEP-statement-and-a-prompt/m-p/130047#M26546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my problem : I've got a table with variables like TEST_Q3_07 TEST_Q4_07 [...] TEST_Q4_2012 THING_Q3_07 THING_Q4_07 [...] THING_Q4_2012&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I'd like is through a prompt and a KEEP statement allow the user to choose which set he'd like to keep.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My prompt would create a macro variable call &amp;amp;Variable and possible values would be TEST or THING and then my question is : how do I include a set of variables in a KEEP statement where's a prompt involved ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's one of the codes I tried, unsuccessfully ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA HISTO ; SET HISTO ;&lt;/P&gt;&lt;P&gt;KEEP=&amp;amp;Variable_Q3_07&amp;nbsp; &amp;amp;Variable_Q4_07 [...] &amp;amp;Variable_Q4_12;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Sep 2013 15:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-variables-with-a-KEEP-statement-and-a-prompt/m-p/130047#M26546</guid>
      <dc:creator>GuiVtzl</dc:creator>
      <dc:date>2013-09-05T15:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Select variables with a KEEP statement and a prompt</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-variables-with-a-KEEP-statement-and-a-prompt/m-p/130048#M26547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;did you try the code with the macro delimiter in the keep statement macro variables?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;KEEP &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;amp;Variable&lt;SPAN style="font-size: 18pt;"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt;_Q3_07&amp;nbsp; &amp;amp;Variable&lt;SPAN style="font-size: 18pt;"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt;_Q4_07 [...] &amp;amp;Variable&lt;SPAN style="font-size: 18pt;"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt;_Q4_12;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by the way if you are using keep as part of the data step there is no = in the syntax. If you move to the set statement and use as a data set option Histo (keep= blah ); they you use the = and this might be a better option depending on the size of the data you are using.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See if that helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Sep 2013 15:46:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-variables-with-a-KEEP-statement-and-a-prompt/m-p/130048#M26547</guid>
      <dc:creator>esjackso</dc:creator>
      <dc:date>2013-09-05T15:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: Select variables with a KEEP statement and a prompt</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-variables-with-a-KEEP-statement-and-a-prompt/m-p/130049#M26548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot, the macro delimiter works fine and the result's exactly what I expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sincerely&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GV&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Sep 2013 16:05:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-variables-with-a-KEEP-statement-and-a-prompt/m-p/130049#M26548</guid>
      <dc:creator>GuiVtzl</dc:creator>
      <dc:date>2013-09-05T16:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: Select variables with a KEEP statement and a prompt</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-variables-with-a-KEEP-statement-and-a-prompt/m-p/130050#M26549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with all the recommendations so far, especially moving KEEP to the SET statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data histo;&lt;/P&gt;&lt;P&gt;set histo (keep=some list of variables);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also note ... if you want ALL variable names that begin with TEST or THING, you can abbreviate the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data histo;&lt;/P&gt;&lt;P&gt;set histo (keep=&amp;amp;variable:);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The colon modifier (no space allowed before the colon) will automatically indicate that your list of variables includes all variable names that start with &amp;amp;VARIABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Sep 2013 16:06:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-variables-with-a-KEEP-statement-and-a-prompt/m-p/130050#M26549</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-09-05T16:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: Select variables with a KEEP statement and a prompt</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-variables-with-a-KEEP-statement-and-a-prompt/m-p/130051#M26550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Astounding ! It will make it better !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sincerely&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Sep 2013 16:23:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-variables-with-a-KEEP-statement-and-a-prompt/m-p/130051#M26550</guid>
      <dc:creator>GuiVtzl</dc:creator>
      <dc:date>2013-09-05T16:23:04Z</dc:date>
    </item>
  </channel>
</rss>

