- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello every one,
could you please tell me how to run a proc means/summary on character variiables:
proc means data=x print missing n nmiss;
var _CHARACTER_;
ods output summary=y;
run;
the above code is returning an error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please provide some sample input data in the form of a data step (as per this article) and also show the log containing the error message you have.
Thanks
Amir.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @aloou ,
Do you want to use character variables to calculate statistics on categories?
if so, you can add the "class" statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can't use char-variables in the var-statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@aloou wrote:
could you please tell me how to run a proc means/summary on character variiables:
Could you please tell us what you would like PROC MEANS or PROC SUMMARY to do with your character variables? You can't compute a mean of character variables. You can't compute a standard deviation. So what is the desired output of PROC MEANS or PROC SUMMARY (or any other procedure) from your character variables?
Perhaps you want to use PROC FREQ on character variables? PROC FREQ produces a count (and percent) of each level of your character variables.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Mr Paige i hope that you are doing well.
Yess thats exactly what i want to do, count and percentage of char type variables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @aloou ,
So you should use PROC FREQ. Here is the basic syntax:
proc freq data=have noprint;
table var_char / out=want;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Usine SQL instead.
proc sql; select n(sex) as n,nmiss(sex) as nmiss from sashelp.class; quit;