BookmarkSubscribeRSS Feed
Tom
Super User Tom
Super User

To get the number of observations in multiple tables just use PROC CONTENTS or DICTIONARY.TABLES.

proc sql noprint ;

  create table counts as

     select memname,nlobs

     from dictionary.tables

     where libname = 'NACO'

        and upcase(memname) like 'NACO_%'

     order by 1

;

quit;

1 REPLY 1
Aljay
Calcite | Level 5

I am trying to get record count form updated datasets using naming convention financial_account_YYYYMM that range from 201212 back to 200706. The datasets are stored in the following path: '/sas/data/dds_test/

The below code is not working for me and I am new to do loops> any help would be appreciated...

LIBNAME DDSTEST '/sas/data/dds_test/

proc sql;
  create table rl_668_SUM
  (
    MNTH num,
    CNT num
  );
quit;

data _null_;
  do i=200706 to 201212;
    call execute('proc sql;
                              insert into  rl_668_SUM

                         set MNTH='||strip(put(i,best.))||',

                               CNT = (select count(1) from DDSTEST.Financial_account_'||strip(put(I,best.)||');

                             
                                                              quit;');
    end;
run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 680 views
  • 0 likes
  • 2 in conversation