<?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: out of range error in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/out-of-range-error/m-p/13687#M2046</link>
    <description>Hi:&lt;BR /&gt;
  GETVARN returns the value of a numeric VARIABLE:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000148384.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000148384.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
  However, you cannot debug GETVARN separate from the OPEN, FETCHOBS VARNUM and CLOSE functions. They are all documented in the Function and Call Routine doc:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245852.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245852.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
    <pubDate>Sun, 20 Feb 2011 17:53:11 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2011-02-20T17:53:11Z</dc:date>
    <item>
      <title>out of range error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/out-of-range-error/m-p/13684#M2043</link>
      <description>Hi,&lt;BR /&gt;
I am getting this error, can any one help me.&lt;BR /&gt;
thank you&lt;BR /&gt;
&lt;BR /&gt;
GETVARN referenced by the %SYSFUNC or %QSYSFUNC macro function&lt;BR /&gt;
         is out of range.&lt;BR /&gt;
&lt;BR /&gt;
my code:&lt;BR /&gt;
%MACRO SaveItemOrder;&lt;BR /&gt;
%let ordervar=3;&lt;BR /&gt;
DATA _NULL_;&lt;BR /&gt;
/* Datasets to draw values from*/&lt;BR /&gt;
	%LET dataQmatrix=%SYSFUNC(OPEN(work.Qmatrix,i));&lt;BR /&gt;
		%DO i=1 %TO 7;&lt;BR /&gt;
/* Assign new macro variables as global*/&lt;BR /&gt;
			%GLOBAL itemorder&amp;amp;i;&lt;BR /&gt;
/* Gets entire row of data*/&lt;BR /&gt;
			%LET row=%SYSFUNC(FETCHOBS(&amp;amp;dataQmatrix,&amp;amp;i));&lt;BR /&gt;
/* Grabs specific value for threshold from that row*/&lt;BR /&gt;
			%LET item&amp;amp;i.=%SYSFUNC(GETVARN(&amp;amp;dataQmatrix.,&lt;BR /&gt;
					     %SYSFUNC(VARNUM(&amp;amp;dataQmatrix.,&amp;amp;ordervar.))));&lt;BR /&gt;
/* Transferring value to global macro, and checking via log;*/&lt;BR /&gt;
			%LET itemorder&amp;amp;i. = &amp;amp;&amp;amp;item&amp;amp;i.; &lt;BR /&gt;
		    %PUT itemorder&amp;amp;i. &amp;amp;&amp;amp;itemorder&amp;amp;i.; &lt;BR /&gt;
		%END;&lt;BR /&gt;
	/* Close dataset used in program;*/&lt;BR /&gt;
	%LET dataQmatrix=%SYSFUNC(CLOSE(&amp;amp;dataQmatrix.));&lt;BR /&gt;
RUN;&lt;BR /&gt;
%MEND;&lt;BR /&gt;
%SaveItemOrder;</description>
      <pubDate>Sun, 20 Feb 2011 02:38:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/out-of-range-error/m-p/13684#M2043</guid>
      <dc:creator>R_A_G_</dc:creator>
      <dc:date>2011-02-20T02:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: out of range error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/out-of-range-error/m-p/13685#M2044</link>
      <description>Hi R.A.G.  &lt;BR /&gt;
&lt;BR /&gt;
the problem is in second parametr of the GETVARN function. It should be the number of the variable in the Data Set. &lt;BR /&gt;
from now you have 2 options:&lt;BR /&gt;
1 . %LET item&amp;amp;i.=%SYSFUNC(GETVARN(&amp;amp;dataQmatrix.,&amp;amp;ordervar.));&lt;BR /&gt;
&lt;BR /&gt;
2. if you want use VARNUM function you need change second paramets. Instead of &amp;amp;ordervar use var name.&lt;BR /&gt;
&lt;BR /&gt;
Irena</description>
      <pubDate>Sun, 20 Feb 2011 07:08:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/out-of-range-error/m-p/13685#M2044</guid>
      <dc:creator>ariari</dc:creator>
      <dc:date>2011-02-20T07:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: out of range error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/out-of-range-error/m-p/13686#M2045</link>
      <description>Hi Irena ,&lt;BR /&gt;
&lt;BR /&gt;
Thanks that helped. I have another question. when using  this function:&lt;BR /&gt;
%LET item&amp;amp;i.=%SYSFUNC(GETVARN(&amp;amp;dataQmatrix.,&amp;amp;ordervar.));&lt;BR /&gt;
&lt;BR /&gt;
Are we telling SAS to look at each row of the data or each column of the data?&lt;BR /&gt;
&lt;BR /&gt;
Thanks again&lt;BR /&gt;
R.G.</description>
      <pubDate>Sun, 20 Feb 2011 17:42:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/out-of-range-error/m-p/13686#M2045</guid>
      <dc:creator>R_A_G_</dc:creator>
      <dc:date>2011-02-20T17:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: out of range error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/out-of-range-error/m-p/13687#M2046</link>
      <description>Hi:&lt;BR /&gt;
  GETVARN returns the value of a numeric VARIABLE:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000148384.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000148384.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
  However, you cannot debug GETVARN separate from the OPEN, FETCHOBS VARNUM and CLOSE functions. They are all documented in the Function and Call Routine doc:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245852.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245852.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Sun, 20 Feb 2011 17:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/out-of-range-error/m-p/13687#M2046</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-02-20T17:53:11Z</dc:date>
    </item>
  </channel>
</rss>

