DATA Step, Macro, Functions and more

Count for 50 or 100 tables with one shot

Reply
Occasional Contributor
Posts: 13

Count for 50 or 100 tables with one shot


Hi,

I have some 50 tables and i need  table count of each. Apart from running select count (*) from table name.

Do we have any other method that will give in single shot 50 or 100 tables count and table name with proper layout.

Can anyone suggest on this plz.

Header 1Header 2
table name1count1
table name2count2
table name3count3

|

|

|

SAS Super FREQ
Posts: 8,743

Re: Count for 50 or 100 tables with one shot

Hi:

  This is something you could do quite easily by reading the DICTIONARY.TABLES dataset. There are a lot of previous posts about finding out information about your table and columns using this technique. In addition, there are Tech Support notes like this:

http://support.sas.com/kb/25/436.html, and documentation topics like this one:

http://support.sas.com/documentation/cdl/en/sqlproc/65065/HTML/default/viewer.htm#n0cqcq4fhom7qtn17t... (see example 6)

 

  The variables in DICTIONARY.TABLES include a variable called NOBS and another called CRDATE -- which are the count of physical observations and the creation date, respectively.

 

cynthia

Occasional Contributor
Posts: 13

Re: Count for 50 or 100 tables with one shot

Hi Cynthia,

Thank you for your information. But i am little worried to use dictionary. Because there seems to be every time i need to select respective table name in find for your contents. Actually i dont want contents at all. I only require table name and respective count of that table like 500 observations. if number of tables are 50 or >50 at single shot how i can get the output which shows 50 table names with respective counts in proper lay out.

Super User
Posts: 17,819

Re: Count for 50 or 100 tables with one shot

Open up sashelp.vtable and take a look at the columns and run the following and see what it outputs.

Proc print data=sashelp.vtable (obs=20);

var libname memname nobs nlobs nvar;

run;

Occasional Contributor
Posts: 13

Re: Count for 50 or 100 tables with one shot

Hi reeza,

Its nice. But i have created a new library and i only want count from that particular library and not from any other (rawdata,gismaps ets) with out mentioning obs. Can you plz suggest me

Super User
Super User
Posts: 6,500

Re: Count for 50 or 100 tables with one shot

I am not sure what your issue is.  Just run the query and use the data in whatever way you want.

Use a WHERE clause the select the tables you are interested in.

libname mylib 'mypath';

proc sql ;

select memname,nlobs

from dictionary.tables

where libname='MYLIB'

;

quit;

Occasional Contributor
Posts: 13

Re: Count for 50 or 100 tables with one shot

Thank you Tom.

Got it

Ask a Question
Discussion stats
  • 6 replies
  • 314 views
  • 0 likes
  • 4 in conversation