BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Greek
Obsidian | Level 7

Good morning,

I was wondering whether there is a countif function like the one in Excel that can count across rows...

Have

Mary
Mary
Mary
Jim
Jim
Jim
Jim
Jim
Steven
Steven

Want


Mary

3
Jim5
Steven2

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

PROC FREQ.

Proc freq data=sashelp.class;

Table Age/Out=Age_Categories;

run;

View solution in original post

4 REPLIES 4
Reeza
Super User

PROC FREQ.

Proc freq data=sashelp.class;

Table Age/Out=Age_Categories;

run;

Marina
Calcite | Level 5

You also can use PROC SQL or PROC MEANS:

proc sql;

create table want as

select distinct name,

count(name) as count_names

from have

group by name;

quit;

proc means data=have;

class name;

output out=want

     (where=name ne ' '

     drop=_type_

     rename=_freq_=count_names);

run;

data_null__
Jade | Level 19

Check the documentation regarding the NWAY option and you won't need the where data set option.

Also check out TYPES and WAYS statements.

Greek
Obsidian | Level 7

Proc Freq! Of course! Smiley Happy

Thank you.

I wish i knew how to use sql. I keep on bumping to it. It is on my list!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 24421 views
  • 6 likes
  • 4 in conversation