<?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: Please help, how to add a new id column? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Please-help-how-to-add-a-new-id-column/m-p/62929#M17898</link>
    <description>The data step carries a bunch of hidden variables in the pdv that disappear at the end of the data step.  To keep them, one needs to insert them into another field.  The one that you are interested in is _n_;&lt;BR /&gt;
&lt;BR /&gt;
data new;&lt;BR /&gt;
set old;&lt;BR /&gt;
IDNew=_n_;&lt;BR /&gt;
run;</description>
    <pubDate>Mon, 24 Nov 2008 21:07:49 GMT</pubDate>
    <dc:creator>Bill</dc:creator>
    <dc:date>2008-11-24T21:07:49Z</dc:date>
    <item>
      <title>Please help, how to add a new id column?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-help-how-to-add-a-new-id-column/m-p/62928#M17897</link>
      <description>Hi Gurus,&lt;BR /&gt;
&lt;BR /&gt;
Please help.&lt;BR /&gt;
&lt;BR /&gt;
I would like to add a new ID column in existing table with the ID numbers equal the row numbers. Still don't know how.&lt;BR /&gt;
&lt;BR /&gt;
ID  &lt;BR /&gt;
1&lt;BR /&gt;
2&lt;BR /&gt;
3&lt;BR /&gt;
4&lt;BR /&gt;
5&lt;BR /&gt;
...&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I know this is a dumb question, but....

Message was edited by: WAYNE66</description>
      <pubDate>Mon, 24 Nov 2008 19:22:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-help-how-to-add-a-new-id-column/m-p/62928#M17897</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-11-24T19:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: Please help, how to add a new id column?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-help-how-to-add-a-new-id-column/m-p/62929#M17898</link>
      <description>The data step carries a bunch of hidden variables in the pdv that disappear at the end of the data step.  To keep them, one needs to insert them into another field.  The one that you are interested in is _n_;&lt;BR /&gt;
&lt;BR /&gt;
data new;&lt;BR /&gt;
set old;&lt;BR /&gt;
IDNew=_n_;&lt;BR /&gt;
run;</description>
      <pubDate>Mon, 24 Nov 2008 21:07:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-help-how-to-add-a-new-id-column/m-p/62929#M17898</guid>
      <dc:creator>Bill</dc:creator>
      <dc:date>2008-11-24T21:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Please help, how to add a new id column?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-help-how-to-add-a-new-id-column/m-p/62930#M17899</link>
      <description>Hi Wayne,&lt;BR /&gt;
           I have come up with a (sort of) solution, but for sure soon will get the exact solution to your query. Well this is what I thought of:&lt;BR /&gt;
If you can create an ID variable in ur raw data set just analogous to your observation and in ur PROC PRINT use 'NOOBS' option... in dat case , ur ouput wud have soemthg like this:&lt;BR /&gt;
ID &lt;BR /&gt;
1&lt;BR /&gt;
2&lt;BR /&gt;
3&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
10&lt;BR /&gt;
Now this is gonna be fine with few rows ,,, how if the raw data has 100s of rows(I mean really huge data????)???&lt;BR /&gt;
Will find out and let u know sooner.Even I am eager to know abt this...&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
SAS_Learner</description>
      <pubDate>Mon, 24 Nov 2008 23:10:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-help-how-to-add-a-new-id-column/m-p/62930#M17899</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-11-24T23:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Please help, how to add a new id column?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-help-how-to-add-a-new-id-column/m-p/62931#M17900</link>
      <description>As Bill pointed out , a perfect way to do it is to use _n_. This keeps the row number at every row. Once you have a dataset, you just need to create a new variable which is = _n_ and this will work.&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Tue, 25 Nov 2008 11:26:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-help-how-to-add-a-new-id-column/m-p/62931#M17900</guid>
      <dc:creator>tejeshwar</dc:creator>
      <dc:date>2008-11-25T11:26:05Z</dc:date>
    </item>
  </channel>
</rss>

