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

Hello team,

 I need the total rows for a dataset. I use proc means to get the count of a variable in a dataset,

The query gives errors: log says: Variable memberletter in list doesn't match type prescribed for this list.

 

I assume memberletter is a character and means requires data type as number.

I used proc freq and that gave me the memberletter broken by the values that exists in the variable.

I need a total line.

 

I appreciate your response.

 

Regards,

Blue blue

 

Blue Blue
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Proc means will only do statistics for numeric variables. I have to assume you placed the name of a character variable on a VAR statement to generate that message.

 

And why are you using Proc means if you want a number of records in a data set? Proc Contents will do that.

 

Or you could use proc summary with the variable on a CLASS statement (NO var variables).

Or query sashelp.vtables.

 

Instead of piecemeal questions it might help to provide a description of where all this is going and some data.

View solution in original post

2 REPLIES 2
ballardw
Super User

Proc means will only do statistics for numeric variables. I have to assume you placed the name of a character variable on a VAR statement to generate that message.

 

And why are you using Proc means if you want a number of records in a data set? Proc Contents will do that.

 

Or you could use proc summary with the variable on a CLASS statement (NO var variables).

Or query sashelp.vtables.

 

Instead of piecemeal questions it might help to provide a description of where all this is going and some data.

PaigeMiller
Diamond | Level 26

PROC FREQ does give the total. It is the cumulative value in the last row:

 

proc freq data=sashelp.class;
    tables sex;
run;

This produces the total value of N, which is the value of 19 in the cumulative frequency in the last line

 

Capture.PNG

 



 

 

--
Paige Miller

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!

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
  • 2 replies
  • 325 views
  • 2 likes
  • 3 in conversation