<?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: Pinpointing the Location of New Variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Pinpointing-the-Location-of-New-Variable/m-p/568978#M160270</link>
    <description>&lt;P&gt;You can do this in a few ways.&amp;nbsp; Given that you already have an ARRAY statement, the easiest way would be to repeat the ARRAY statement in the second DATA step (with GREECE added in the proper position).&amp;nbsp; Place the revised ARRAY statement between the DATA statement and the SET statement.&lt;/P&gt;</description>
    <pubDate>Wed, 26 Jun 2019 02:46:08 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2019-06-26T02:46:08Z</dc:date>
    <item>
      <title>Pinpointing the Location of New Variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pinpointing-the-Location-of-New-Variable/m-p/568971#M160266</link>
      <description>&lt;P&gt;Can I insert a new variable in a specific position? For example, the following working data set is ordered already and contains some numbers.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _(drop=i);
	array x(*) us uk france germany poland spain italy ireland sweden denmark norway finland china japan korea iran iraq turkey india brazil singapore mexico;
	do i=1 to dim(x);
		x(i)=rannor(1);
	end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If I use the following code, then the new variable greece will be located at the end of the data set.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _;
	set _;
	greece=rannor(1);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I wonder whether the position can be changed—for example, in between the existing variables italy and ireland. Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2019 01:14:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pinpointing-the-Location-of-New-Variable/m-p/568971#M160266</guid>
      <dc:creator>Junyong</dc:creator>
      <dc:date>2019-06-26T01:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: Pinpointing the Location of New Variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pinpointing-the-Location-of-New-Variable/m-p/568978#M160270</link>
      <description>&lt;P&gt;You can do this in a few ways.&amp;nbsp; Given that you already have an ARRAY statement, the easiest way would be to repeat the ARRAY statement in the second DATA step (with GREECE added in the proper position).&amp;nbsp; Place the revised ARRAY statement between the DATA statement and the SET statement.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2019 02:46:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pinpointing-the-Location-of-New-Variable/m-p/568978#M160270</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-06-26T02:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Pinpointing the Location of New Variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pinpointing-the-Location-of-New-Variable/m-p/569131#M160339</link>
      <description>&lt;P&gt;I will say that I have never bothered to worry about the order of variables in a data set. I don't read data sets. Computer code reads data sets and generally doesn't care. I read reports. And I can control the output in the report to get what I need at that point instead of worrying about changes elsewhere.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that code you wrote to process the original data set could have notable issues if you use the variable Greece where the previous value was for a different variable because of array processing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a large number of processes you would likely be ahead to have a transposed data set where you have a variable named COUNTRY that has values like US UK Germany Greece etc. Then you can easily process each country without having to pick it out of a row of similar values.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2019 15:25:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pinpointing-the-Location-of-New-Variable/m-p/569131#M160339</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-26T15:25:37Z</dc:date>
    </item>
  </channel>
</rss>

