<?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 do you create a new variable with Arrays that does not overwrite when... in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602369#M174397</link>
    <description>This is not the correct answer; I keep getting error</description>
    <pubDate>Thu, 07 Nov 2019 13:14:17 GMT</pubDate>
    <dc:creator>Flexluthorella</dc:creator>
    <dc:date>2019-11-07T13:14:17Z</dc:date>
    <item>
      <title>How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602362#M174391</link>
      <description>&lt;P&gt;How do you create a temp dataset multiplying all numeric variables (I coded as oldvar{*} since I do not know them all) by 3 from an original dataset into a new dataset without overwriting the original numbers? Like its similar to the following code but I dont want them replaced in the orginal dataset, I want them in a new data set called newvar. See below for incorrect code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do i = 1 - dim(oldvar);&lt;/P&gt;&lt;P&gt;if oldvar(i) then 999 then call missing (newvar{i});&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;drop i;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 12:54:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602362#M174391</guid>
      <dc:creator>Flexluthorella</dc:creator>
      <dc:date>2019-11-07T12:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602363#M174392</link>
      <description>&lt;P&gt;Just for my own understanding, if your data looks like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input oldvar1-oldvar3 (c1-c3)(:$);
datalines;
1 2 3 a b c
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You want the resulting data to look like this, correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
input oldvar1-oldvar3 newvar1-newvar3 (c1-c3)(:$);
datalines;
1 2 3 3 6 9 a b c
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Nov 2019 12:59:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602363#M174392</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-07T12:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602364#M174393</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/297482"&gt;@Flexluthorella&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I dont want them replaced in the orginal dataset, I want them in a new data set called newvar.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do you mean you want a new VARIABLE called newvar? Your title says you want a new variable, your text says you want a new data set. Please clarify.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 13:04:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602364#M174393</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-11-07T13:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602365#M174394</link>
      <description>&lt;P&gt;The question is "using dataset Nines, create a new temporary dataset which contains revised variables for all of the numeric variables such that the value of the revised variables is 3 times the original value except when the value is 999- code these as missing. Do this using 2 arrays and do not overwrite the data in the original variables."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 13:04:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602365#M174394</guid>
      <dc:creator>Flexluthorella</dc:creator>
      <dc:date>2019-11-07T13:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602366#M174395</link>
      <description>&lt;P&gt;its a new variable in a new temporary dataset.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 13:04:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602366#M174395</guid>
      <dc:creator>Flexluthorella</dc:creator>
      <dc:date>2019-11-07T13:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602368#M174396</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;if oldvar(i) then 999 then call missing (newvar{i});&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you clean up the syntax here, it seems that your code will do exactly what you want.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 13:12:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602368#M174396</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-11-07T13:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602369#M174397</link>
      <description>This is not the correct answer; I keep getting error</description>
      <pubDate>Thu, 07 Nov 2019 13:14:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602369#M174397</guid>
      <dc:creator>Flexluthorella</dc:creator>
      <dc:date>2019-11-07T13:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602370#M174398</link>
      <description>&lt;P&gt;Here is the original dataset&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 13:22:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602370#M174398</guid>
      <dc:creator>Flexluthorella</dc:creator>
      <dc:date>2019-11-07T13:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602371#M174399</link>
      <description>&lt;P&gt;Your code is &lt;EM&gt;incomplete&lt;/EM&gt;. Which dataset you create happens in the DATA statement, and the SET statement determines which dataset is read.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 13:22:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602371#M174399</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-07T13:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602372#M174400</link>
      <description>&lt;P&gt;here is the code and error i have&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 13:23:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602372#M174400</guid>
      <dc:creator>Flexluthorella</dc:creator>
      <dc:date>2019-11-07T13:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602377#M174404</link>
      <description>&lt;P&gt;The syntax of&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;array newvar{*} _temporary_;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is not correct. You have to actually name the variables that will appear in the array newvar;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the future, please include code and log directly in the message (as text, not as a screen capture) by copying the text and then pasting it into the window that appears when you click on the &lt;FONT face="courier new,courier"&gt;{i}&lt;/FONT&gt; icon (for the log) or the window that appears when you click on the running man icon (for code). Providing code and log as an attachment is not preferred.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 13:41:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602377#M174404</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-11-07T13:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602380#M174407</link>
      <description>&lt;P&gt;Start by learning the very basics of data step programming.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;do i = 1 - 5;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is incorrect, as you define a starting value of -4, and no end value.&lt;/P&gt;
&lt;P&gt;Iterative do loops need the keyword "to", like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;do i = 1 to 5;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You also define array newvar, but use newvar&lt;STRONG&gt;s&lt;/STRONG&gt; further down the code. That's the cause for the "undefined array reference" error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, finally:&lt;/P&gt;
&lt;P&gt;Do &lt;FONT size="4"&gt;&lt;STRONG&gt;NOT&lt;/STRONG&gt;&lt;/FONT&gt; post code, logs or data in pictures. NEVER EVER.&lt;/P&gt;
&lt;P&gt;Copy/paste code into a window opened with the "little running man", and logs and textual data into a window opened with the {i} button.&lt;/P&gt;
&lt;P&gt;Assuming that we have nothing better to do than typing data tediously from a picture is not very polite.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 13:37:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602380#M174407</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-07T13:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602382#M174409</link>
      <description>&lt;P&gt;I am so sorry I am very new at this and I feel as though the output I need does not make sense. I am still not getting the correct output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It still include the character variables and the newvar do not show up. How do I add the multiplier of three to the numeric variables in the new dataset bythree?&lt;/P&gt;&lt;PRE&gt;libname learn "XXX";
data by three:
set learn.Nines;
array oldvar(8)  x y z a1 a2 a3 a4 a5;
array newvar(8) x3 y3 z3 a13 a23 a33 a43 a53; 
do i = 1 to 8;
if oldvar{i} = 999 the call missing (newvar{i});
end;
drop i;
run; &lt;/PRE&gt;&lt;P&gt;of three to the new variables?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 13:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602382#M174409</guid>
      <dc:creator>Flexluthorella</dc:creator>
      <dc:date>2019-11-07T13:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602386#M174411</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/297482"&gt;@Flexluthorella&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It still include the character variables and the newvar do not show up. How do I add the multiplier of three to the numeric variables in the new dataset bythree?&lt;/P&gt;
&lt;PRE&gt;libname learn "XXX";
data by three:
set learn.Nines;
array oldvar(8)  x y z a1 a2 a3 a4 a5;
array newvar(8) x3 y3 z3 a13 a23 a33 a43 a53; 
do i = 1 to 8;
if oldvar{i} = 999 the call missing (newvar{i});
end;
drop i;
run; &lt;/PRE&gt;
&lt;P&gt;of three to the new variables?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Explain this. What multiplier of three? Where do you want to multiply by three? Give an example. There is no such thing in your code.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 13:55:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602386#M174411</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-11-07T13:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602388#M174412</link>
      <description>The values in the variables x y z a1 a2 a3 a4 a5. They are simple numbers ranging from 2-999. Example the 1st value in variable X is 4 therefore X3 in newvar should be 12.</description>
      <pubDate>Thu, 07 Nov 2019 13:58:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602388#M174412</guid>
      <dc:creator>Flexluthorella</dc:creator>
      <dc:date>2019-11-07T13:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602393#M174416</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname learn "XXX";
data by_three;
set learn.Nines;
array oldvar(8)  x y z a1 a2 a3 a4 a5;
array newvar(8) x3 y3 z3 a13 a23 a33 a43 a53; 
do i = 1 to 8;
newvar{i}=3*oldvar{i};
end;
drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Nov 2019 14:16:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602393#M174416</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-11-07T14:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602395#M174417</link>
      <description>&lt;P&gt;Your code looks very close.&lt;/P&gt;
&lt;P&gt;Fix your DATA statement. Right now you are creating two datasets, one named BY and one named THREE, that both have the same data.&lt;/P&gt;
&lt;P&gt;You forgot to assign any values to your new variables.&lt;/P&gt;
&lt;P&gt;Can you figure out what statement you would need to set the new variable to three times the old variable?&amp;nbsp; And where you would put that code?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 14:10:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602395#M174417</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-11-07T14:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602396#M174418</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/297482"&gt;@Flexluthorella&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am so sorry I am very new at this and I feel as though the output I need does not make sense. I am still not getting the correct output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It still include the character variables and the newvar do not show up. How do I add the multiplier of three to the numeric variables in the new dataset bythree?&lt;/P&gt;
&lt;PRE&gt;libname learn "XXX";
data by three:
set learn.Nines;
array oldvar(8)  x y z a1 a2 a3 a4 a5;
array newvar(8) x3 y3 z3 a13 a23 a33 a43 a53; 
do i = 1 to 8;
if oldvar{i} = 999 the call missing (newvar{i});
end;
drop i;
run; &lt;/PRE&gt;
&lt;P&gt;of three to the new variables?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You don't get any output because of several syntax errors:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data by three:&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;A statement needs to be terminated with a semicolon, not a colon. And do you really want to create two new datasets?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if oldvar{i} = 999 the call missing (newvar{i});&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;should be&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if oldvar{i} = 999 then call missing (newvar{i});&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input x y z a1 a2 a3 a4 a5;
datalines;
1 2 3 4 999 6 7 8
;

data by_three;
set have;
array oldvar(8)  x y z a1 a2 a3 a4 a5;
array newvar(8) x3 y3 z3 a13 a23 a33 a43 a53; 
do i = 1 to 8;
  if oldvar{i} ne 999 then newvar{i} = 1;
end;
drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Since all new variables are set to missing when an iteration of the data step starts, call missing() will not have any visible effect, so I did the opposite to show how the code works. Read the log, and you'll see that it's perfectly clean.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 14:13:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602396#M174418</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-07T14:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602411#M174425</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/297482"&gt;@Flexluthorella&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does this help you?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input x y z a1 a2 a3 a4 a5;
datalines;
1 2 3 4 999 6 7 8
1 3 2 3 9   1 2 3
4 5 1 7 1   2 1 2
;
run;

data want;
set have;
array oldvar  x y z a1-a5;
array newvar  nx ny nz na1-na5;
do i = 1 to dim(oldvar);
   if oldvar[i] = 999 then newvar[i] = .;
   else newvar[i] = oldvar[i] * 3;
end;
drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture_01.JPG" style="width: 485px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33739i4564460579CEEFF0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture_01.JPG" alt="Capture_01.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 14:56:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602411#M174425</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2019-11-07T14:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do you create a new variable with Arrays that does not overwrite when...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602728#M174535</link>
      <description>I doubt you'll ever get a positive response with a post like that.  If you're new to SAS, why are you working with arrays?  Keep it simple, explain what you're trying to accomplish and remain moderately humble.</description>
      <pubDate>Fri, 08 Nov 2019 13:49:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-create-a-new-variable-with-Arrays-that-does-not/m-p/602728#M174535</guid>
      <dc:creator>tomrvincent</dc:creator>
      <dc:date>2019-11-08T13:49:38Z</dc:date>
    </item>
  </channel>
</rss>

