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;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 4 replies
  • 759 views
  • 0 likes
  • 1 in conversation