<?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: soustract a variable to the all table in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/soustract-a-variable-to-the-all-table/m-p/648777#M22237</link>
    <description>&lt;P&gt;Thanks ! but i'm wondering usually i'm using "i" as a macrovariable when it isn't in a data set and that's working. So it's cause is inside a data set that i cannot use this writing : "&amp;amp;i" ?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 May 2020 07:47:32 GMT</pubDate>
    <dc:creator>boubou31</dc:creator>
    <dc:date>2020-05-19T07:47:32Z</dc:date>
    <item>
      <title>soustract a variable to the all table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/soustract-a-variable-to-the-all-table/m-p/648769#M22233</link>
      <description>&lt;P&gt;Hello guys,&lt;BR /&gt;What i want to do here is to soustract a value to my all tables. What i don't understand is that when i'm doing step by step it's working. like wha't follow :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data wilco;
	set test;
	var1=var1-varvec;
	var2=var2-varvec;
	
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but i want to do it for 128 variable so you can understand that i don't want to write all the unnecessary line.&amp;nbsp; I tried something like that :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data wilco;
	set test;
	do i= 1 to 128;
		var&amp;amp;i.= var&amp;amp;i.-varvec;
	end;
	
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But in fact it's ignoring my loop part and just do the set part. i'm surely missing something there, and if you could help me to find it !&amp;nbsp;&lt;BR /&gt;Thanks.&lt;/P&gt;&lt;PRE&gt;NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      32768 at 85:17   
NOTE: There were 256 observations read from the data set WORK.TEST.
NOTE: The data set WORK.WILCO has 256 observations and 131 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2020 06:59:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/soustract-a-variable-to-the-all-table/m-p/648769#M22233</guid>
      <dc:creator>boubou31</dc:creator>
      <dc:date>2020-05-19T06:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: soustract a variable to the all table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/soustract-a-variable-to-the-all-table/m-p/648776#M22236</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/327159"&gt;@boubou31&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your example, "i" is not a macrovariable so you can't refer to it as &amp;amp;i.&lt;/P&gt;
&lt;P&gt;What you need is an array, to reference a group of columns of the same type.&lt;/P&gt;
&lt;P&gt;in the below code, var1 is equivalent to var(1), as this variable is in position 1 in the array.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data wilco;
	set test;
	array var(128); /* the array 'var' references a group of columns: var1, var2, ... until var 128*/
	do i= 1 to dim(array); /* the array dimension is 128  = the DIM(function) */
		var(i)= var(i)-varvec;
	end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2020 07:39:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/soustract-a-variable-to-the-all-table/m-p/648776#M22236</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-19T07:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: soustract a variable to the all table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/soustract-a-variable-to-the-all-table/m-p/648777#M22237</link>
      <description>&lt;P&gt;Thanks ! but i'm wondering usually i'm using "i" as a macrovariable when it isn't in a data set and that's working. So it's cause is inside a data set that i cannot use this writing : "&amp;amp;i" ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2020 07:47:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/soustract-a-variable-to-the-all-table/m-p/648777#M22237</guid>
      <dc:creator>boubou31</dc:creator>
      <dc:date>2020-05-19T07:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: soustract a variable to the all table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/soustract-a-variable-to-the-all-table/m-p/648779#M22238</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/327159"&gt;@boubou31&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can refer to &amp;amp;i as a macrovariable if you use iterative DO statements inside a macro:&lt;/P&gt;
&lt;P&gt;%do i=1 %to 128;&lt;/P&gt;
&lt;P&gt;... -&amp;gt; using &amp;amp;i.&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2020 07:53:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/soustract-a-variable-to-the-all-table/m-p/648779#M22238</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-19T07:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: soustract a variable to the all table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/soustract-a-variable-to-the-all-table/m-p/648780#M22239</link>
      <description>Thanks ! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Tue, 19 May 2020 08:07:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/soustract-a-variable-to-the-all-table/m-p/648780#M22239</guid>
      <dc:creator>boubou31</dc:creator>
      <dc:date>2020-05-19T08:07:44Z</dc:date>
    </item>
  </channel>
</rss>

