BookmarkSubscribeRSS Feed
celbel
Calcite | Level 5

I've created a table where I extracted all the data I need using proc sql, now from that code I want to get a count of the data in one column.. does anyone have any tips?

5 REPLIES 5
Reeza
Super User

PROC FREQ. 

 

proc freq data=sashelp.class;
table age;
run;

Otherwise, show an example of what you're looking to calculate overall. 

 


@celbel wrote:

I've created a table where I extracted all the data I need using proc sql, now from that code I want to get a count of the data in one column.. does anyone have any tips?


 

celbel
Calcite | Level 5

doing this would isolate the one column I'm looking at but what I really want is to be able to get a count of how many rows are in that column

 

so for example, let's say that column contains all the ingredients I need for a recipe, I actually just want a count, so a number of how many things are on that list

Reeza
Super User

Ok, lots of ways to get that value.

 

What are you planning to do with it? Depending on what the next step is you may want it in a macro variable or data set. If you're  looking for verification or to check it, that information is also in the log after the creation. 

 

proc means data=have N;
run;

You can also use PROC CONTENTS to view a description of the data set:

 

proc contents data=have;
run;
Ksharp
Super User
proc freq data=sashelp.class nlevels;
table age;
run;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3582 views
  • 0 likes
  • 4 in conversation