<?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: Debug my code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236360#M268216</link>
    <description>%let dsName=;&lt;BR /&gt; 57         options nomprint nomlogic;&lt;BR /&gt; 58         &lt;BR /&gt; 59         %macro check(dsName= );&lt;BR /&gt; 60         &lt;BR /&gt; 61         %let dsid=%sysfunc(open(&amp;amp;dsName, IS));&lt;BR /&gt; 62         &lt;BR /&gt; 63         %if &amp;amp;dsid=0 %then %put %sysfunc(sysmsg());&lt;BR /&gt; 64         &lt;BR /&gt; 65         %let nlobs= %sysfunc(attrn(&amp;amp;dsid,NLOBS));&lt;BR /&gt; 66         &lt;BR /&gt; 67         %put No of Observation in dataset %trim(&amp;amp;dsName) : %trim(&amp;amp;nlobs);&lt;BR /&gt; 68         &lt;BR /&gt; 69         %let rc= %sysfunc(close(&amp;amp;dsid));&lt;BR /&gt; 70         &lt;BR /&gt; 71         %mend;&lt;BR /&gt; 72         &lt;BR /&gt; 73         %check(dsName=work.data1);&lt;BR /&gt; ERROR: File WORK.DATA1.DATA does not exist.&lt;BR /&gt; WARNING: Argument 1 to function ATTRN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.&lt;BR /&gt; NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The result of the operations have been set &lt;BR /&gt;       to a missing value.&lt;BR /&gt; No of Observation in dataset work.data1 : .   getting this error what to do??</description>
    <pubDate>Wed, 25 Nov 2015 10:39:46 GMT</pubDate>
    <dc:creator>RTelang</dc:creator>
    <dc:date>2015-11-25T10:39:46Z</dc:date>
    <item>
      <title>Debug my code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236348#M268210</link>
      <description>&lt;P&gt;plz find &amp;amp; remove the&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="sasSource"&gt;%let dsName=;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;57 options nomprint nomlogic;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;58&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;59 %macro check(dsName= );&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;60&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;61 %let dsid = %sysfunc(open(&amp;amp;dsName, IS));&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;62&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;63 %if &amp;amp;dsid = 0 %then %put %sysfunc(sysmsg());&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;64&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;65 %let nlobs = %sysfunc(attrn(&amp;amp;dsid,NLOBS));&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;66&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;67 %put No of Observation in dataset %trim(&amp;amp;dsName) : %trim(&amp;amp;nlobs);&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;68&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;69 %let rc = %sysfunc(close(&amp;amp;dsid));&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;70&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;71 %mend;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;72&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;73 %check(dsName=);&lt;/DIV&gt;
&lt;DIV id="sasLogError1_1448444580933" class="sasError"&gt;ERROR: There is not a default input data set (_LAST_ is _NULL_).&lt;/DIV&gt;
&lt;DIV id="sasLogWarning1_1448444580933" class="sasWarning"&gt;WARNING: Argument 1 to function ATTRN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.&lt;/DIV&gt;
&lt;DIV id="sasLogNote1_1448444580933" class="sasNote"&gt;NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The result of the operations have been set&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;to a missing value.&lt;/DIV&gt;</description>
      <pubDate>Wed, 25 Nov 2015 09:45:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236348#M268210</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-11-25T09:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Debug my code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236352#M268211</link>
      <description>&lt;P&gt;You have not provided a dataset in the parameter to the macro call:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%check(dsName=);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ^&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This is invalid as open needs a valid dataset. &amp;nbsp;As you have gone ahead with this solution, you will need to include further code at the beginning of the macro to ensure that the dataset is valid and exists, i.e.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%if %sysfunc(exists(&amp;amp;dsname.)) %then %do;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; your macro code&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;%else %do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; %put Dataset &amp;amp;dsname. does not exist;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or,&amp;nbsp;your could just not use macro code at all and go with:&lt;/P&gt;
&lt;PRE&gt;proc sql noprint;
  select  NOBS 
  into    NUMOBS
  from    DICTIONARY.TABLES 
  where   LIBNAME="SASHELP"
    and   MEMNAME="CLASS";
quit;&lt;/PRE&gt;
&lt;P&gt;As there is almost never a "need" to do things in macro language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 10:19:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236352#M268211</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-11-25T10:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Debug my code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236356#M268212</link>
      <description>%let dsName=;&lt;BR /&gt;options nomprint nomlogic;&lt;BR /&gt;&lt;BR /&gt;%macro check(dsName= );&lt;BR /&gt;&lt;BR /&gt;%let dsid=%sysfunc(open(&amp;amp;dsName, IS));&lt;BR /&gt;&lt;BR /&gt;%if &amp;amp;dsid=0 %then %put %sysfunc(sysmsg());&lt;BR /&gt;&lt;BR /&gt;%let nlobs= %sysfunc(attrn(&amp;amp;dsid,NLOBS));&lt;BR /&gt;&lt;BR /&gt;%put No of Observation in dataset %trim(&amp;amp;dsName) : %trim(&amp;amp;nlobs);&lt;BR /&gt;&lt;BR /&gt;%let rc= %sysfunc(close(&amp;amp;dsid));&lt;BR /&gt;&lt;BR /&gt;%mend;&lt;BR /&gt;&lt;BR /&gt;%check(dsName=)  &lt;BR /&gt;&lt;BR /&gt;add ?? where?? show..</description>
      <pubDate>Wed, 25 Nov 2015 10:34:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236356#M268212</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-11-25T10:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Debug my code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236357#M268213</link>
      <description>&lt;P&gt;Here, in my post, where the upward point triangle is, you need to put a dataset (with library if not work);&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%check(dsName=);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ^&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;E.g.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%check(dsName=sashelp.class);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 10:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236357#M268213</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-11-25T10:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Debug my code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236358#M268214</link>
      <description>basically i need a macro to display number of observations in a dataset for eg dsname=100</description>
      <pubDate>Wed, 25 Nov 2015 10:36:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236358#M268214</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-11-25T10:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Debug my code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236359#M268215</link>
      <description>can u rectify my cod e&amp;amp; give me -thanks</description>
      <pubDate>Wed, 25 Nov 2015 10:37:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236359#M268215</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-11-25T10:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: Debug my code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236360#M268216</link>
      <description>%let dsName=;&lt;BR /&gt; 57         options nomprint nomlogic;&lt;BR /&gt; 58         &lt;BR /&gt; 59         %macro check(dsName= );&lt;BR /&gt; 60         &lt;BR /&gt; 61         %let dsid=%sysfunc(open(&amp;amp;dsName, IS));&lt;BR /&gt; 62         &lt;BR /&gt; 63         %if &amp;amp;dsid=0 %then %put %sysfunc(sysmsg());&lt;BR /&gt; 64         &lt;BR /&gt; 65         %let nlobs= %sysfunc(attrn(&amp;amp;dsid,NLOBS));&lt;BR /&gt; 66         &lt;BR /&gt; 67         %put No of Observation in dataset %trim(&amp;amp;dsName) : %trim(&amp;amp;nlobs);&lt;BR /&gt; 68         &lt;BR /&gt; 69         %let rc= %sysfunc(close(&amp;amp;dsid));&lt;BR /&gt; 70         &lt;BR /&gt; 71         %mend;&lt;BR /&gt; 72         &lt;BR /&gt; 73         %check(dsName=work.data1);&lt;BR /&gt; ERROR: File WORK.DATA1.DATA does not exist.&lt;BR /&gt; WARNING: Argument 1 to function ATTRN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.&lt;BR /&gt; NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The result of the operations have been set &lt;BR /&gt;       to a missing value.&lt;BR /&gt; No of Observation in dataset work.data1 : .   getting this error what to do??</description>
      <pubDate>Wed, 25 Nov 2015 10:39:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236360#M268216</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-11-25T10:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: Debug my code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236361#M268217</link>
      <description>&lt;P&gt;In your library WORK, there is no dataset called DATA1. &amp;nbsp;This is what the log message is telling you. &amp;nbsp;The macro will only work on a dataset which exists in the library given. &amp;nbsp;So open SAS, find a dataset, if there is nothing in your WORK library, then look at SASHELP. &amp;nbsp;Take the CLASS dataset as an example from there and replace work.data1 in your example with sashelp.class.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 10:42:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236361#M268217</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-11-25T10:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: Debug my code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236391#M268218</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60507"&gt;@RTelang﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you just "&lt;SPAN&gt;need a macro to display number of observations in a dataset" (as you say) or a macro for some other day-to-day task, you can resort to existing macros on the web. Why reinvent the wheel? For example, have a look at&amp;nbsp;&lt;A href="http://www.datasavantconsulting.com/roland/index.html" target="_blank"&gt;Roland's SAS® Macros&lt;/A&gt;. This website also contains many tips and tricks for writing your own macros from the author of this large macro collection, Roland Rashleigh-Berry&amp;nbsp;(a former colleague of mine).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 13:18:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236391#M268218</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2015-11-25T13:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: Debug my code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236586#M268219</link>
      <description>&lt;P&gt;If you need a macro that gives you the number of rows in a table, the minimum input to this macro needs to be the name of a specific table for which you want the number of rows.&lt;/P&gt;
&lt;P&gt;E.g.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%check(dsName=sashelp.class);&lt;/PRE&gt;
&lt;P&gt;You suggest a solution where you would like to to supply "dsName=100". What kind of input is the value 100? How will this input be used to give you the number of rows in a table?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you are not yet&amp;nbsp;familiar with macro functionality and how to call a macro? Then I suggest some reading. E.g.&lt;/P&gt;
&lt;P&gt;&lt;A title="Introduction to the Macro Facility" href="http://support.sas.com/documentation/cdl/en/mcrolref/67912/HTML/default/viewer.htm#p14qac7nd7n0s1n1rfte5bwrpfcy.htm" target="_self"&gt;Introduction to the Macro Facility&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2015 13:05:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Debug-my-code/m-p/236586#M268219</guid>
      <dc:creator>Rikard</dc:creator>
      <dc:date>2015-11-26T13:05:48Z</dc:date>
    </item>
  </channel>
</rss>

