<?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: Listing variables to print in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Listing-variables-to-print/m-p/945562#M370439</link>
    <description>&lt;P&gt;I agree about y: but it is just a demo example. But the question was about listing all the variables which are not starting with x as in real life, we either don't know the name of the variables in advance or the list is so long that automating is worth it.&lt;/P&gt;</description>
    <pubDate>Sun, 29 Sep 2024 03:38:40 GMT</pubDate>
    <dc:creator>xxformat_com</dc:creator>
    <dc:date>2024-09-29T03:38:40Z</dc:date>
    <item>
      <title>Listing variables to print</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Listing-variables-to-print/m-p/945522#M370431</link>
      <description>&lt;P&gt;As far as I know it is not possible to use "not" with &amp;lt;varname&amp;gt;: to list a series of variable not starting with.&lt;/P&gt;
&lt;P&gt;In other words, it is not possible to do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tmp;
x1=1;
x2=2;
y1=1;
y2=2;
run;

proc print data=tmp;
    var not(x:) x:;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;We can still use a macro variable:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tmp;
x1=1;
x2=2;
y1=1;
y2=2;
run;

proc sql noprint;
    select name into: notx separated by ' '
    from dictionary.columns
    where libname='WORK' and
          memname='TMP' and
          upcase(name) not like 'X%';
quit;  

proc print data=tmp;
    var &amp;amp;notx. x:;
run;    &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Would you have any other suggestion?&lt;/P&gt;</description>
      <pubDate>Sat, 28 Sep 2024 08:33:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Listing-variables-to-print/m-p/945522#M370431</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2024-09-28T08:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Listing variables to print</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Listing-variables-to-print/m-p/945523#M370432</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/184742"&gt;@xxformat_com&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your particular example you could use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=tmp;
var y: x:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=tmp;
id y:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Other forms of &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lepg/p08ywlo51p6ezbn1lde9f0aphq6r.htm" target="_blank" rel="noopener"&gt;variable lists&lt;/A&gt; might be applicable to different cases.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DROP= dataset option can exclude variable lists:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=have(drop=x:);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In your example it could be used in a DATA step view:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data v / view=v;
set tmp(drop=x:);
set tmp;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Sep 2024 09:33:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Listing-variables-to-print/m-p/945523#M370432</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-09-28T09:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Listing variables to print</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Listing-variables-to-print/m-p/945562#M370439</link>
      <description>&lt;P&gt;I agree about y: but it is just a demo example. But the question was about listing all the variables which are not starting with x as in real life, we either don't know the name of the variables in advance or the list is so long that automating is worth it.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Sep 2024 03:38:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Listing-variables-to-print/m-p/945562#M370439</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2024-09-29T03:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Listing variables to print</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Listing-variables-to-print/m-p/945563#M370440</link>
      <description>&lt;P&gt;I like the two set statements.&lt;/P&gt;
&lt;P&gt;Is there a specific reason for preferring a view over a dataset?&lt;/P&gt;</description>
      <pubDate>Sun, 29 Sep 2024 03:44:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Listing-variables-to-print/m-p/945563#M370440</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2024-09-29T03:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Listing variables to print</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Listing-variables-to-print/m-p/945610#M370451</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/184742"&gt;@xxformat_com&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I like the two set statements.&lt;/P&gt;
&lt;P&gt;Is there a specific reason for preferring a view over a dataset?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I thought using a view is conceptually closer to your intention of just printing an existing dataset as opposed to creating a new one with selected or reordered variables.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Sep 2024 19:56:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Listing-variables-to-print/m-p/945610#M370451</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-09-29T19:56:00Z</dc:date>
    </item>
  </channel>
</rss>

