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;
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!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.