<?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: place variable in specific place in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/place-variable-in-specific-place/m-p/719435#M27666</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table want as
    select id
          ,name
          ,dob
          ,status
          ,place
    from have;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    retain id name dob status;
    set have;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 15 Feb 2021 19:00:09 GMT</pubDate>
    <dc:creator>mklangley</dc:creator>
    <dc:date>2021-02-15T19:00:09Z</dc:date>
    <item>
      <title>place variable in specific place</title>
      <link>https://communities.sas.com/t5/New-SAS-User/place-variable-in-specific-place/m-p/719433#M27665</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a dataset with variables:&lt;/P&gt;&lt;P&gt;ID Name DOB Place Status&lt;/P&gt;&lt;P&gt;I want a variable "Status"&amp;nbsp;to place after DOB&lt;/P&gt;&lt;P&gt;ID Name DOB Status Place&lt;/P&gt;&lt;P&gt;Can I make a code saying variable Status after DOB? or at 4th position?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know. thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 18:43:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/place-variable-in-specific-place/m-p/719433#M27665</guid>
      <dc:creator>Smitha9</dc:creator>
      <dc:date>2021-02-15T18:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: place variable in specific place</title>
      <link>https://communities.sas.com/t5/New-SAS-User/place-variable-in-specific-place/m-p/719435#M27666</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table want as
    select id
          ,name
          ,dob
          ,status
          ,place
    from have;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    retain id name dob status;
    set have;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 19:00:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/place-variable-in-specific-place/m-p/719435#M27666</guid>
      <dc:creator>mklangley</dc:creator>
      <dc:date>2021-02-15T19:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: place variable in specific place</title>
      <link>https://communities.sas.com/t5/New-SAS-User/place-variable-in-specific-place/m-p/719456#M27667</link>
      <description>&lt;P&gt;First, you can't move a variable in a data set without making a new copy.&amp;nbsp; Here's one way to make that copy, taking advantage of the sas data step compiler:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  merge have (keep=ID Name DOB ) have (keep=status) have;     /*corrected typo */
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The SAS compiler will arrange variables in the order they are revealed in the code.&amp;nbsp; So:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;First merge have has ID NAME DOB&amp;nbsp; (but ordered in whatever relative positions they have in the original).&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;Second merge have gets STATUS, placed to the right of the above.&lt;/LI&gt;
&lt;LI&gt;Third merge have gets all the remaining variables, in their original order, placed to the right of STATUS.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 19:25:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/place-variable-in-specific-place/m-p/719456#M27667</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-02-15T19:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: place variable in specific place</title>
      <link>https://communities.sas.com/t5/New-SAS-User/place-variable-in-specific-place/m-p/719540#M27671</link>
      <description>&lt;P&gt;The position of variable in a dataset is completely irrelevant for processing the data, with one exception: proc export. For anything else: don't waste your time!&lt;/P&gt;
&lt;P&gt;But if you insist, here is another way to re-order the variables:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.class;
  format Name Weight Age Sex Height;
  set sashelp.class;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Feb 2021 06:29:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/place-variable-in-specific-place/m-p/719540#M27671</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-02-16T06:29:32Z</dc:date>
    </item>
  </channel>
</rss>

