<?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: Determine and return the number of physical observations in the specified dataset. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236320#M43286</link>
    <description>&lt;P&gt;Please check the link pasted&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/sugi26/p095-26.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi26/p095-26.pdf&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Nov 2015 05:44:04 GMT</pubDate>
    <dc:creator>AbhiD</dc:creator>
    <dc:date>2015-11-25T05:44:04Z</dc:date>
    <item>
      <title>Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236319#M43285</link>
      <description>&lt;P&gt;a generic macro to Determine and return the number of physical observations in the specified dataset.!!!&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 05:37:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236319#M43285</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-11-25T05:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236320#M43286</link>
      <description>&lt;P&gt;Please check the link pasted&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/sugi26/p095-26.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi26/p095-26.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 05:44:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236320#M43286</guid>
      <dc:creator>AbhiD</dc:creator>
      <dc:date>2015-11-25T05:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236321#M43287</link>
      <description>thanks but i wanted a custom made code with parameters to do so can u provide 1?</description>
      <pubDate>Wed, 25 Nov 2015 05:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236321#M43287</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-11-25T05:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236323#M43289</link>
      <description>&lt;P&gt;%macro check(dsName = );&lt;BR /&gt;%let dsid = %sysfunc(open(&amp;amp;dsName, IS));&lt;/P&gt;&lt;P&gt;%if &amp;amp;DSID = 0 %then&lt;BR /&gt;%put %sysfunc(sysmsg());&lt;BR /&gt;%let nlobs = %sysfunc(attrn(&amp;amp;dsid,NLOBS));&lt;/P&gt;&lt;P&gt;%put No of Observation in dataset %trim(&amp;amp;dsName) : %trim(&amp;amp;nlobs);&lt;/P&gt;&lt;P&gt;%let rc = %sysfunc(close(&amp;amp;dsid));&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%check(dsName = );&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 06:42:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236323#M43289</guid>
      <dc:creator>AbhiD</dc:creator>
      <dc:date>2015-11-25T06:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236327#M43292</link>
      <description>dsid, rc, ??? have u defined it, have u run it does it work does it return the number of observations i want the number that's imp. "a macro to determine the number of obs in a data set"</description>
      <pubDate>Wed, 25 Nov 2015 06:56:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236327#M43292</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-11-25T06:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236328#M43293</link>
      <description>&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data A;
  Do i=1 To 18;
    Output;
  End;
Run;

Proc SQL NoPrint;
  * If a dataset is required use;
  Create Table xx As Select Nobs From Dictionary.Tables 
  Where UpCase(Libname)='WORK' AND UpCase(Memname)='A' ;
  * If you need a macro-variable;
  Select Nobs Into :M_Nobs Trimmed From Dictionary.Tables 
  Where UpCase(Libname)='WORK' AND UpCase(Memname)='A' ;
Quit;
%Put ***&amp;amp;M_Nobs.*;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Nov 2015 07:09:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236328#M43293</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2015-11-25T07:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236329#M43294</link>
      <description>&lt;P&gt;Yes it works if you would have ran it you would have known&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Abhi&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 07:15:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236329#M43294</guid>
      <dc:creator>AbhiD</dc:creator>
      <dc:date>2015-11-25T07:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236333#M43295</link>
      <description>yes i run d code but it did not give the number of obs &amp;amp; is ur macro call correct?!!!</description>
      <pubDate>Wed, 25 Nov 2015 07:30:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236333#M43295</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-11-25T07:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236334#M43296</link>
      <description>&lt;P&gt;can you paste what macro call u used and the log for the same&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 07:46:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236334#M43296</guid>
      <dc:creator>AbhiD</dc:creator>
      <dc:date>2015-11-25T07:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236335#M43297</link>
      <description>options nomprint nomlogic;&lt;BR /&gt;%macro check(dsName = );&lt;BR /&gt;%let dsid = %sysfunc(open(&amp;amp;dsName, IS));&lt;BR /&gt;&lt;BR /&gt;%if &amp;amp;DSID = 0 %then&lt;BR /&gt;%put %sysfunc(sysmsg());&lt;BR /&gt;%let nlobs = %sysfunc(attrn(&amp;amp;dsid,NLOBS));&lt;BR /&gt;%put No of Observation in dataset %trim(&amp;amp;dsName) : %trim(&amp;amp;nlobs);&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;the log &lt;BR /&gt;&lt;BR /&gt;options nomprint nomlogic;&lt;BR /&gt;%macro check(dsName = );&lt;BR /&gt;%let dsid = %sysfunc(open(&amp;amp;dsName, IS));&lt;BR /&gt;&lt;BR /&gt;%if &amp;amp;DSID = 0 %then&lt;BR /&gt;%put %sysfunc(sysmsg());&lt;BR /&gt;%let nlobs = %sysfunc(attrn(&amp;amp;dsid,NLOBS));&lt;BR /&gt;%put No of Observation in dataset %trim(&amp;amp;dsName) : %trim(&amp;amp;nlobs);&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= );</description>
      <pubDate>Wed, 25 Nov 2015 08:06:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236335#M43297</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-11-25T08:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236336#M43298</link>
      <description>what is RC &amp;amp; IS i couldn't ur logic...</description>
      <pubDate>Wed, 25 Nov 2015 08:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236336#M43298</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-11-25T08:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236340#M43299</link>
      <description>&lt;P&gt;In ur macro call please could you pass the dataset name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%check(dsName= &amp;lt;&amp;lt;YOUR DATASET NAME HERE LIBRARY.DATASETNAME)&amp;gt;&amp;gt; );&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 08:51:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236340#M43299</guid>
      <dc:creator>AbhiD</dc:creator>
      <dc:date>2015-11-25T08:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236346#M43301</link>
      <description>55         &lt;BR /&gt; 56         %let dsName=data1;&lt;BR /&gt; 57         options nomprint nomlogic;&lt;BR /&gt; 58         %macro check(dsName= );&lt;BR /&gt; 59         %let dsid = %sysfunc(open(&amp;amp;dsName, IS));&lt;BR /&gt; 60         &lt;BR /&gt; 61         %if &amp;amp;DSID = 0 %then&lt;BR /&gt; 62         %put %sysfunc(sysmsg());&lt;BR /&gt; 63         %let nlobs = %sysfunc(attrn(&amp;amp;dsid,NLOBS));&lt;BR /&gt; 64         %put No of Observation in dataset %trim(&amp;amp;dsName) : %trim(&amp;amp;nlobs);&lt;BR /&gt; 65         %let rc = %sysfunc(close(&amp;amp;dsid));&lt;BR /&gt; 66         &lt;BR /&gt; 67         %mend;&lt;BR /&gt; 68         &lt;BR /&gt; 69         %check(dsName=);&lt;BR /&gt; ERROR: There is not a default input data set (_LAST_ is _NULL_).&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 : .</description>
      <pubDate>Wed, 25 Nov 2015 09:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236346#M43301</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-11-25T09:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236347#M43302</link>
      <description>its a generic macro i don't hav data i need a code which is error free&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Nov 2015 09:33:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236347#M43302</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-11-25T09:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236349#M43303</link>
      <description>what variables are RC &amp;amp; IS ??</description>
      <pubDate>Wed, 25 Nov 2015 10:01:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236349#M43303</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-11-25T10:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236353#M43305</link>
      <description>&lt;P&gt;"Why" do you need a macro? &amp;nbsp;Have you created code which does this in Base SAS, if so then provide it, and that can then be put into a macro. &amp;nbsp;If you just want the number of observations from a dataset, then query the metadata tables (SASHELP.VTABLE, VCOLUMN, or DICTIONARY.TABLES, COLUMS in SQL). &amp;nbsp;User24feb has given you the code for this type of thing. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 10:23:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236353#M43305</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-11-25T10:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236372#M43307</link>
      <description>&lt;P&gt;In&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%check(dsName=);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you specifically submitted an empty string to the macro, so no dataset could be found.&lt;/P&gt;
&lt;P&gt;Supply a valid dataset name, and the macro will work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Inform yourself about how parameters are passed to macros.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 11:20:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236372#M43307</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-11-25T11:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236432#M43325</link>
      <description>&lt;P&gt;Here's a macro similar to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/63155"&gt;@AbhiD﻿&lt;/a&gt;.&amp;nbsp; If you don't specify a data set in the macro call, it will print to the log saying no data set specified (1st call).&amp;nbsp; If you specify a data set that does not exist, it will print ot the log saying the data set does not exist (2nd call).&amp;nbsp; If you specify an existing data set, it will print to the log the number of observations in that data set (3rd call).&amp;nbsp; I'm not sure what you're looking to do with the number of observations, so you may want to be more specific.&amp;nbsp; For example, if you want the number of observations in a macro variable or a data set, or if you just want it printed to the log (which is what this will do):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro nobs(dsn);
%if &amp;amp;dsn= %then %do;
	%put *****************************;
	%put *** No Data Set Specified ***;
	%put *****************************;
%end;

%else %do;
	%let dsid=%sysfunc(open(&amp;amp;dsn));

	%if &amp;amp;dsid=0 %then %do;
		%put *******************************;
		%put *** Data Set Does Not Exist ***;
		%put *******************************;
	%end;

	%else %do;
		%let obs=%sysfunc(attrn(&amp;amp;dsid,nlobs));
		%put ****************************************************;
		%put *** Number of Observations in Data Set is = &amp;amp;obs ***;
		%put ****************************************************;
	%end;
%end;
%mend;

%nobs();
%nobs(data);

data test;
	do i=1 to 10;
	output;
	end;
run;

%nobs(test);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Nov 2015 15:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236432#M43325</guid>
      <dc:creator>dcruik</dc:creator>
      <dc:date>2015-11-25T15:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236499#M43331</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60507"&gt;@RTelang﻿&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;You're asking for ready made code without putting in some own work first - and amazingly people in this forum work for you free of charge.&lt;/P&gt;
&lt;P&gt;I believe it's now really up-to-you to spend a bit of time to understand the answers and use stuff as people tell you it needs to be used.&lt;/P&gt;
&lt;P&gt;If you continue on the path you've taken then I start to think "troll".&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 21:26:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236499#M43331</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-11-25T21:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and return the number of physical observations in the specified dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236545#M43338</link>
      <description>i hav done the prog am trying to find a suitable logic through ur inputs has &amp;amp; seen before i gave my code to debug or to see if its correct. am a student learning sas so more number q's from me, give some time i may provide solution to ur probs Patrick k</description>
      <pubDate>Thu, 26 Nov 2015 08:54:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-and-return-the-number-of-physical-observations-in-the/m-p/236545#M43338</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-11-26T08:54:09Z</dc:date>
    </item>
  </channel>
</rss>

