BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Is there in SAS function to return records count of the table?
4 REPLIES 4
deleted_user
Not applicable
Data X;
A=1;
;
Run;

Proc SQL;
Create table COUNT as select * from dictionary.tables
Where Libname='WORK' and memname='X';
Quit;
deleted_user
Not applicable
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?
deleted_user
Not applicable
Sorry for stupid question

the solution is

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

Am I right?
deleted_user
Not applicable
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;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 4 replies
  • 874 views
  • 0 likes
  • 1 in conversation