@Xyp wrote: How do I count all the non missing observations of a bunch of categorical variables then present these counts on a bar chart?
The above statement can be interpreted at least two ways: counts of each level of the categorical variable or total count of non-missing observations.
It is always a good idea to provide example data, or use one of the training data set supplied by SAS such as SASHELP.CLASS, and then show the expected results. Since SASHELP.CLASS only has 19 observations it is usually pretty easy to do the calculations by hand.
Second you talk about using Proc Freq then Proc Means but do not provide any details of exactly how you are using them.
Then the actual bar chart code you use. Some of this may very well be possible with just the graph procedure (and possibly a custom format to assign all non-missing values to a single value of "not missing" or similar).
Are your categorical variables numeric, character or a mix?
Here's an example with a custom format and summary using Proc Freq using ODS OUTPUT and plotting one of the variables. Without an example of what your plots are supposed to look like can't go much further.
data work.class;
set sashelp.class;
if name in ('Alfred' 'Henry') then call missing(sex);
if name in ('Barbara' 'Jane' 'John') then call missing(age);
run;
proc format;
value num_notmiss
.='Missing'
other= 'Not missing'
;
value $char_notmiss
' '='Missing'
other= 'Not missing'
;
run;
proc freq data=work.class;
ods output onewayfreqs= work.classcount;
table sex age;
format sex $char_notmiss. age num_notmiss.;
run;
proc sgplot data=work.classcount;
vbar f_age / freq=frequency datalabel;
run;
Note the way the output data set from Proc Freq looks and the use of the F_ named variable to have the custom formatted text as the only category reported.
... View more