<?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: how to put a senquence of variables in by statement? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-put-a-senquence-of-variables-in-by-statement/m-p/761642#M241038</link>
    <description>&lt;P&gt;Thanks, Tom.&lt;/P&gt;&lt;P&gt;It works perfectly!&lt;/P&gt;</description>
    <pubDate>Sun, 15 Aug 2021 03:44:46 GMT</pubDate>
    <dc:creator>canvaschen</dc:creator>
    <dc:date>2021-08-15T03:44:46Z</dc:date>
    <item>
      <title>how to put a senquence of variables in by statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-put-a-senquence-of-variables-in-by-statement/m-p/761631#M241033</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have several variables called V1 V2 ... Vn, how can I put this sequence in by statement to make the sample group by every variable in this sequence?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc ttest data=test3;&lt;BR /&gt;by V1 V2 ... Vn;&lt;BR /&gt;var ret;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The n is one of my macro variables, and sometimes I need to change the value of n.&lt;/P&gt;</description>
      <pubDate>Sun, 15 Aug 2021 02:02:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-put-a-senquence-of-variables-in-by-statement/m-p/761631#M241033</guid>
      <dc:creator>canvaschen</dc:creator>
      <dc:date>2021-08-15T02:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to put a senquence of variables in by statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-put-a-senquence-of-variables-in-by-statement/m-p/761632#M241034</link>
      <description>&lt;P&gt;First thing is figure out the SAS code you want.&lt;/P&gt;
&lt;P&gt;If your variables are really named V1, V2, V3, V4 and V5 then the BY statement is simply:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;by v1-v5 ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now if the want to use a macro variable to help generate that statement you could put 5 into the macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let n=5;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then use it to create the BY statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;by v1-v&amp;amp;n;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 15 Aug 2021 02:42:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-put-a-senquence-of-variables-in-by-statement/m-p/761632#M241034</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-15T02:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to put a senquence of variables in by statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-put-a-senquence-of-variables-in-by-statement/m-p/761642#M241038</link>
      <description>&lt;P&gt;Thanks, Tom.&lt;/P&gt;&lt;P&gt;It works perfectly!&lt;/P&gt;</description>
      <pubDate>Sun, 15 Aug 2021 03:44:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-put-a-senquence-of-variables-in-by-statement/m-p/761642#M241038</guid>
      <dc:creator>canvaschen</dc:creator>
      <dc:date>2021-08-15T03:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to put a senquence of variables in by statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-put-a-senquence-of-variables-in-by-statement/m-p/761902#M241167</link>
      <description>&lt;P&gt;Tom always gets the solves.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If anyone else is interested and find this, this alternative way is available.&amp;nbsp; If all one wishes to use all variables in the data set that start with same prefix ( say v in this case) then&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*no let statement */
proc ttest data=test3;
  by V: ; /*colon operator*/
  var ret;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Aug 2021 19:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-put-a-senquence-of-variables-in-by-statement/m-p/761902#M241167</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-08-16T19:57:49Z</dc:date>
    </item>
  </channel>
</rss>

