Hi - I am trying to generate graph for categorical variables which has value of (missing, 0 and 1 for numeric value). Currently, I have a code which only displays the non-missing values (0,1) and I am wondering if sgplot need any instruction to display the missing bucket.
FYI: My list of variable contains both numeric and character so depending on type, I will have '.' for numeric and '' for character.
Below is the code:
add "missing" to your "vbar ... " statements. like below:
DATA cars1;
infile DATALINES dsd missover;
INPUT var val;
CARDS;
,0.2099
0,0.4749
1,0.7827
;
RUN;
proc sgplot data=cars1;
vbar var / response=val group=var
datalabel datalabelattrs=(weight=bold) missing;
yaxis grid label='Actual Default Rate' ;
run;
DATA cars2;
infile DATALINES dsd missover;
INPUT var $ val;
CARDS;
,0.2099
A,0.4749
B,0.7827
;
proc sgplot data=cars2;
vbar var / response=val group=var
datalabel datalabelattrs=(weight=bold) missing;
yaxis grid label='Actual Default Rate' ;
run;
add "missing" to your "vbar ... " statements. like below:
DATA cars1;
infile DATALINES dsd missover;
INPUT var val;
CARDS;
,0.2099
0,0.4749
1,0.7827
;
RUN;
proc sgplot data=cars1;
vbar var / response=val group=var
datalabel datalabelattrs=(weight=bold) missing;
yaxis grid label='Actual Default Rate' ;
run;
DATA cars2;
infile DATALINES dsd missover;
INPUT var $ val;
CARDS;
,0.2099
A,0.4749
B,0.7827
;
proc sgplot data=cars2;
vbar var / response=val group=var
datalabel datalabelattrs=(weight=bold) missing;
yaxis grid label='Actual Default Rate' ;
run;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.