Hello friend,
Happy New Year!I have the following data set and am trying to create a line graph with 95% CI. I used the proc sgplot (below). But it gives 95% CI as shade. Can anyone help me tell me how to do 95% CI as bar, not as shadow.
data have;
input Month_year $ frequency StdDev ColPercent ColStdErr ColLowerCL ColUpperCL positive negative;
cards;
Jan_2018 27580 729.40706 1.0132 0.0182 0.9776 1.0488 0.0356041171 0.0356041171
Feb_2018 25225 678.96555 1.0562 0.0195 1.0179 1.0944 0.0382764006 0.0382764006
Mar_2018 28230 746.38890 1.0956 0.0194 1.0576 1.1335 0.0379820518 0.0379820518
Apr_2018 26760 700.25026 1.0778 0.0188 1.0410 1.1146 0.0368349788 0.036834978
May_2018 27550 742.60845 1.0735 0.0195 1.0353 1.1118 0.0382656688 0.038265668
Jun_2018 25035 679.67669 1.0136 0.0187 0.9770 1.0502 0.0366360408 0.0366360408
Jul_2018 26160 716.09459 1.0352 0.0195 0.9970 1.0734 0.0381609915 0.0381609915
;
proc sgplot data=have;
band x=Month_year lower=ColLowerCL upper=ColUpperCL / transparency=0.5;
series x=Month_year y=ColPercent ;
run;
Thnaks
Muni
proc sgplot data=have;
scatter x=Month_year y=colPercent / yerrorlower=ColLowerCL yerrorupper = ColUpperCL ;
series x=Month_year y=ColPercent ;
run;
Use a SERIES plot instead of BAND. You can customize it further using options on the SERIES statement, to hide the marker or change colours or add/remove endcaps etc.
See the docs for all options:
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/p1lcbd3lhs3t3bn1jk6d8sjt2yqx.htm
@sandrube wrote:
Hello friend,
Happy New Year!I have the following data set and am trying to create a line graph with 95% CI. I used the proc sgplot (below). But it gives 95% CI as shade. Can anyone help me tell me how to do 95% CI as bar, not as shadow.
data have;
input Month_year $ frequency StdDev ColPercent ColStdErr ColLowerCL ColUpperCL positive negative;
cards;
Jan_2018 27580 729.40706 1.0132 0.0182 0.9776 1.0488 0.0356041171 0.0356041171
Feb_2018 25225 678.96555 1.0562 0.0195 1.0179 1.0944 0.0382764006 0.0382764006
Mar_2018 28230 746.38890 1.0956 0.0194 1.0576 1.1335 0.0379820518 0.0379820518
Apr_2018 26760 700.25026 1.0778 0.0188 1.0410 1.1146 0.0368349788 0.036834978
May_2018 27550 742.60845 1.0735 0.0195 1.0353 1.1118 0.0382656688 0.038265668
Jun_2018 25035 679.67669 1.0136 0.0187 0.9770 1.0502 0.0366360408 0.0366360408
Jul_2018 26160 716.09459 1.0352 0.0195 0.9970 1.0734 0.0381609915 0.0381609915
;
proc sgplot data=have;
band x=Month_year lower=ColLowerCL upper=ColUpperCL / transparency=0.5;
series x=Month_year y=ColPercent ;
run;
Thnaks
Muni
Do you mean something like that:
proc sgplot data=have;
HIGHLOW x=Month_year LOW=ColLowerCL HIGH=ColUpperCL / TYPE=BAR transparency=0.5 BARWIDTH=0.5;
series x=Month_year y=ColPercent ;
run;
B.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.