<?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: Where is ROW in proc sql? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Where-is-ROW-in-proc-sql/m-p/69997#M15147</link>
    <description>That is exactly what I need. Thanks a lot.</description>
    <pubDate>Thu, 26 May 2011 15:51:54 GMT</pubDate>
    <dc:creator>buckeye</dc:creator>
    <dc:date>2011-05-26T15:51:54Z</dc:date>
    <item>
      <title>Where is ROW in proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-is-ROW-in-proc-sql/m-p/69995#M15145</link>
      <description>Hi all,&lt;BR /&gt;
&lt;BR /&gt;
With Number specified in proc sql as an option shown below, but I couldn't get it in the subsequent data file mytable.&lt;BR /&gt;
&lt;BR /&gt;
Is the ROW just for the printing purpose and we can not use it as a field or column? Thanks in advance.&lt;BR /&gt;
&lt;BR /&gt;
data tbl;&lt;BR /&gt;
input first $1. second third fourth ;&lt;BR /&gt;
datalines&lt;BR /&gt;
;&lt;BR /&gt;
a 21 22 23&lt;BR /&gt;
s 31 32 33&lt;BR /&gt;
d 41 42 43&lt;BR /&gt;
f 51 52 53&lt;BR /&gt;
;&lt;BR /&gt;
run&lt;BR /&gt;
;&lt;BR /&gt;
proc sql number ;&lt;BR /&gt;
create table mytbl as&lt;BR /&gt;
select * from tbl;&lt;BR /&gt;
/* select statements */&lt;BR /&gt;
select * from mytbl;&lt;BR /&gt;
select 'r' || row as myrownumber, * from mytbl;&lt;BR /&gt;
quit;</description>
      <pubDate>Thu, 26 May 2011 13:26:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-is-ROW-in-proc-sql/m-p/69995#M15145</guid>
      <dc:creator>buckeye</dc:creator>
      <dc:date>2011-05-26T13:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: Where is ROW in proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-is-ROW-in-proc-sql/m-p/69996#M15146</link>
      <description>Hello Buckeye,&lt;BR /&gt;
&lt;BR /&gt;
If you would like to number your rows like r1, r2, r3, etc. then it could be done like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc SQL;&lt;BR /&gt;
  create table mytbl as&lt;BR /&gt;
  select CATS("r",put(MONOTONIC(),6.)) as myrownumber, * from tbl;&lt;BR /&gt;
quit; &lt;BR /&gt;
proc print data=mytbl noobs;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Thu, 26 May 2011 15:06:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-is-ROW-in-proc-sql/m-p/69996#M15146</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-05-26T15:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Where is ROW in proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-is-ROW-in-proc-sql/m-p/69997#M15147</link>
      <description>That is exactly what I need. Thanks a lot.</description>
      <pubDate>Thu, 26 May 2011 15:51:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-is-ROW-in-proc-sql/m-p/69997#M15147</guid>
      <dc:creator>buckeye</dc:creator>
      <dc:date>2011-05-26T15:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Where is ROW in proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-is-ROW-in-proc-sql/m-p/69998#M15148</link>
      <description>Hi:&lt;BR /&gt;
  It is up to you whether to use MONOTONIC() or not. However, you should be aware of this Tech Support note:&lt;BR /&gt;
&lt;A href="http://support.sas.com/kb/15/138.html" target="_blank"&gt;http://support.sas.com/kb/15/138.html&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Thu, 26 May 2011 19:33:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-is-ROW-in-proc-sql/m-p/69998#M15148</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-05-26T19:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Where is ROW in proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-is-ROW-in-proc-sql/m-p/69999#M15149</link>
      <description>I've used the MONOTINC function with no ill effects for one table processing.  I believe when joins occur the MONOTONIC function may fail.  Sounds like a fun experiment!</description>
      <pubDate>Thu, 26 May 2011 20:01:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-is-ROW-in-proc-sql/m-p/69999#M15149</guid>
      <dc:creator>darrylovia</dc:creator>
      <dc:date>2011-05-26T20:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: Where is ROW in proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-is-ROW-in-proc-sql/m-p/70000#M15150</link>
      <description>Hello Cynthia,&lt;BR /&gt;
There is a solution without MONOTONIC():&lt;BR /&gt;
[pre]&lt;BR /&gt;
data tbl;&lt;BR /&gt;
  input first $1. second third fourth ;&lt;BR /&gt;
  row+1;&lt;BR /&gt;
datalines;&lt;BR /&gt;
a 21 22 23&lt;BR /&gt;
s 31 32 33&lt;BR /&gt;
d 41 42 43&lt;BR /&gt;
f 51 52 53&lt;BR /&gt;
run;&lt;BR /&gt;
proc SQL;&lt;BR /&gt;
  create table mytbl(drop=row) as&lt;BR /&gt;
  select CATS("r",put(row,6.)) as myrownumber, * from tbl;&lt;BR /&gt;
quit; &lt;BR /&gt;
[/pre]&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Thu, 26 May 2011 20:20:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-is-ROW-in-proc-sql/m-p/70000#M15150</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-05-26T20:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: Where is ROW in proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-is-ROW-in-proc-sql/m-p/70001#M15151</link>
      <description>Hi:&lt;BR /&gt;
  Yes, that is probably what I would do if I needed a row-type identifier. As long as it is understood that when adding or deleting observations from the table, some action would need to be taken to redo the numbers and/or if sorting in some different order, then the numbers might appear out of their original order.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Thu, 26 May 2011 22:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-is-ROW-in-proc-sql/m-p/70001#M15151</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-05-26T22:00:02Z</dc:date>
    </item>
  </channel>
</rss>

