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

AI Navigator GIF.gif


Navigate AI governance with SAS tools for compliance and ethical AI practices. Try SAS Ai Navigator for free for the first six months.

Check it out on Microsoft Marketplace →

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 3933 views
  • 0 likes
  • 3 in conversation