BookmarkSubscribeRSS Feed
sandrube
Fluorite | Level 6

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

3 REPLIES 3
Reeza
Super User
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


 

yabwon
Onyx | Level 15

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.

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Reeza
Super User
FYI - I would recommend changing that first column to a SAS date instead of a character and then having it formatted for display.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 3869 views
  • 0 likes
  • 3 in conversation