Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- SAS 9.3 GRAPH QUESTION-POLYGON and Line Segment

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-02-2016 11:06 AM

Hello,everyone,

I want to draw a polygon simulated confidence interval.

My coordinates for (x1,y1) are over 2000,I know it's easy to do that in SAS 9.4 or R,however I only have SAS 9.3,I checked some references,it seems that in sas 9.3 annotation dataset 'POLYGON' (or 'POLYCONT')function only accept numbers input-once for a pair coordinates,is it possible to use variable here?

Moreover would you please give me some hints about how to draw line segment in SAS?

Thank you very much!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-02-2016 11:18 AM

For line segments with SAS 9.3 SGPLOT, you can use either a Vector plot or a Series plot.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-02-2016 11:45 AM

Vector plot works very well,thank you Sanjay!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-02-2016 11:21 AM

What statistic are you forming the confidene interval for? Why do you think you want to use a polygon? More details, please!

For a continuous curve, use the BAND statement to display a confidence interval.

For a series of simulated Cis (such as for many simulated CIs for the mean), use the HIGHLOW statement to create a series of confidence intervals.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-02-2016 11:44 AM

Thank you so much for your quick reply,Rick! I am sorry I can't explain "Why you need it",for my professor asked me to use SAS to rewrite some R codes which are from former research projects-we need SAS output(but must including everything from R code).This is an example https://www.uvm.edu/~ngotelli/Rscripts/Confidence%20Interval%20Polygon.R

Can I do this in SAS?Thank you very much!

Can I do this in SAS?Thank you very much!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-02-2016 12:32 PM

Consistency with R will be much easier with SAS 9.4. For an academic institution, it should be easy to upgrade. You could even use SAS University Edition, which is free, and provides all the SAS 9.4 features, including SGPLOT and GTL.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-02-2016 01:07 PM

Yes. That plot is easily created by using the BAND statement.

If you are translating from R to SAS, you should realize that not every program has a one-to-one mapping. Every language has conventions that make it unique. In particular, when you see the polygon() call in R, that does not necessarily mean that you should use the POLYGON statement in PROC SGPLOT.

PS: As a former professor myself, I predict that your professor would be thrilled to explain more about the plot and what it shows! Professors love it when students ask questions!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-02-2016 02:23 PM

Here it is:

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-03-2016 05:59 AM

Here is the SAS program that generates the graph:

```
data CI;
call streaminit(12345);
do x = 1 to 100;
Exp = 50 + x*0.1;
ConHigh = Exp + 5 + rand("normal");
ConLow = Exp - 5 + rand("normal");
OneRun = Exp + rand("Normal",0,2);
output;
end;
run;
title "SGPLOT Reconstruction of R Graphic";
proc sgplot data=CI noautolegend;
band x=x lower=ConLow upper=ConHigh / fillattrs=(color=thistle);
series x=x y=Exp / lineattrs=(color="purple");
series x=x y=OneRun;
xaxis label="Time Step";
yaxis label="Population Size (N)";
run;
```

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-03-2016 10:29 PM

Thank you so much! That helps a lot! I have solved problem with band graph,thank you very much!