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

hi, I have a data file something like this,

policynumber    name

3                       Jon

4                       Alex

3                       Jon

5                       Tim

3                        Jon

 

i want to count how many number of policies each individual has, can anyone please help me in this

1 ACCEPTED SOLUTION

Accepted Solutions
MikeZdeb
Rhodochrosite | Level 12

Hi, or other PROCS ...


proc means data=x n nonobs;
class name;
run;

 

proc freq data=x;
table name;
run;

View solution in original post

5 REPLIES 5
ChrisBrooks
Ammonite | Level 13

There are a few different ways of doing this - you could do something like

 

proc sql;
	create table polcount
	as select name, count(name) as totalpols
	from have
	group by name;
quit;

 

hmc
Calcite | Level 5 hmc
Calcite | Level 5

Thank you, can i use that code in SAS? 

ChrisBrooks
Ammonite | Level 13

You certainly can - if it fits the bill could you mark my reply as an accepted solution please? It saves others from responding to an issue which has already been solved.

MikeZdeb
Rhodochrosite | Level 12

Hi, or other PROCS ...


proc means data=x n nonobs;
class name;
run;

 

proc freq data=x;
table name;
run;

hmc
Calcite | Level 5 hmc
Calcite | Level 5

thank you i got it

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
  • 5 replies
  • 1015 views
  • 0 likes
  • 3 in conversation