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

Screen Shot 2018-12-10 at 4.35.13 PM.png

 

What is an appropriate procedure that I can use in SAS to count the number of people in each department? I've provided a snippet of the dataset.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
r_behata
Barite | Level 11

proc freq data= emp noprint;
	tables dept / missing out=temp(drop=percent);
run;

View solution in original post

5 REPLIES 5
novinosrin
Tourmaline | Level 20

proc freq/sql/summary.  take a look

 


proc sql;

create table want as

select dept, n(emp) as num_of_people

from have

group by dept;

quit;

 

sasnewbie5
Fluorite | Level 6

Is there one that doesn't use SQL statements? I tried using the proc freq but for some reason it just output the dataset I already had.

r_behata
Barite | Level 11

proc freq data= emp noprint;
	tables dept / missing out=temp(drop=percent);
run;
sasnewbie5
Fluorite | Level 6

How could I use a procedure to calculate the average salary and also the number of ppl in each department. The code I have below gives the following message: Statement is not valid or it is used out of proper order. Not sure what the problem is. I was trying to use proc means.

 

proc means data = hw9.combo;
	class dept;
	mean = salary;
run;
PeterClemmensen
Tourmaline | Level 20

Please post usable sample data in the form of a data step if you want tested, usable code answers 🙂

 

Do something like this

 

proc freq data=have;
   tables dept;
run;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 885 views
  • 0 likes
  • 4 in conversation