The SAS Output Delivery System and reporting techniques

Records Count

Reply
N/A
Posts: 0

Records Count

Is there in SAS function to return records count of the table?
N/A
Posts: 0

Re: Records Count

Posted in reply to deleted_user
Data X;
A=1;
;
Run;

Proc SQL;
Create table COUNT as select * from dictionary.tables
Where Libname='WORK' and memname='X';
Quit;
N/A
Posts: 0

Re: Records Count

Posted in reply to deleted_user
Thanks.

If I want only distinct records (by Field1), I must execute 2 queries?

create table test as (
select distinct Field1, Field2, Field3 from Table1
);


and after

select count(*) into: COUNT from test;

Or I can do it in one step?
N/A
Posts: 0

Re: Records Count

Posted in reply to deleted_user
Sorry for stupid question

the solution is

select count(Field1) as COUNT, Field2, Field3 from Table1

Am I right?
N/A
Posts: 0

Re: Records Count

Posted in reply to deleted_user
I think you need something like this:

proc sql;
create table NEW_TABLE as
select Field1, Field2, Field3
count(Field3) as COUNT3,
count(Field2) as Count2,
count(distinct Field1) as Count1_DISTINCT
from YOUR_TABLE;
quit;
Ask a Question
Discussion stats
  • 4 replies
  • 175 views
  • 0 likes
  • 1 in conversation