<?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: Creating new variable at specific position in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variable-at-specific-position/m-p/783377#M249767</link>
    <description>Same as ChrisNZ:&lt;BR /&gt;&lt;BR /&gt;data have;&lt;BR /&gt;retain var1-var1000 1;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt; if 0 then set have(keep=var1-var50);&lt;BR /&gt; length new_var $ 200 ;&lt;BR /&gt; set have;&lt;BR /&gt; new_var='NewVariable';&lt;BR /&gt;run;</description>
    <pubDate>Wed, 01 Dec 2021 12:19:10 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2021-12-01T12:19:10Z</dc:date>
    <item>
      <title>Creating new variable at specific position</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variable-at-specific-position/m-p/783303#M249734</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;In an interview&amp;nbsp; of SAS, I have asked this question that In my dataset if I have 1000 variables so I want to create new variable&amp;nbsp;@ 5th place or 50th place what method I should choose?&lt;/P&gt;&lt;P&gt;Any help appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 23:50:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variable-at-specific-position/m-p/783303#M249734</guid>
      <dc:creator>nilu10686</dc:creator>
      <dc:date>2021-11-30T23:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variable at specific position</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variable-at-specific-position/m-p/783310#M249737</link>
      <description>&lt;P&gt;This is one way:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  retain Var1 Var2 Var3 Var4 NewVar;
  set have;
  NewVar = "NewVal";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But IMHO it's a dumb question as the position of a variable has no effect on processing or analysis. The only time I reposition variables is to regroup them for browsing in a viewer.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 02:50:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variable-at-specific-position/m-p/783310#M249737</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-12-01T02:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variable at specific position</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variable-at-specific-position/m-p/783316#M249740</link>
      <description>&lt;P&gt;For 50th place, I'd use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WANT;
  if 0 then set HAVE (keep=VAR1--VAR49);
  length NEWVAR 8;
  if 0 then set HAVE (keep=VAR50--VAR99);
  .. normal SAS code ...
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp; said that's not an interesting question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 05:30:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variable-at-specific-position/m-p/783316#M249740</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-12-01T05:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variable at specific position</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variable-at-specific-position/m-p/783377#M249767</link>
      <description>Same as ChrisNZ:&lt;BR /&gt;&lt;BR /&gt;data have;&lt;BR /&gt;retain var1-var1000 1;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt; if 0 then set have(keep=var1-var50);&lt;BR /&gt; length new_var $ 200 ;&lt;BR /&gt; set have;&lt;BR /&gt; new_var='NewVariable';&lt;BR /&gt;run;</description>
      <pubDate>Wed, 01 Dec 2021 12:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variable-at-specific-position/m-p/783377#M249767</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-12-01T12:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variable at specific position</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-new-variable-at-specific-position/m-p/783378#M249768</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;But IMHO it's a dumb question as the position of a variable has no effect on processing or analysis. The only time I reposition variables is to regroup them for browsing in a viewer.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I give extra points for this answer, if I'm asking the question in an interview.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 12:38:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-new-variable-at-specific-position/m-p/783378#M249768</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-12-01T12:38:44Z</dc:date>
    </item>
  </channel>
</rss>

