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 Procedures
- /
- grapic questions

- 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

04-09-2009 04:00 AM

Dear all,

I have two simple questions.

First, is it possible to autosave the figure by "pdf" file? I reviewed your website http://www.ats.ucla.edu/stat/sas/faq/sasgraphs.htm the title is represented as "How can I save a SAS graph to a gif file? ?". However, I cannot find the solution to this problem.

Second, is it possible to create a subplot in SAS?I hope to put first figure in left panel and the secend figure in the right panel. Like in R, we can use par(mfrow)

%%%%%%%%%% In R %%%%%%%%%%%%%%

par(mfrow=c(1,3))#create a 1*3 matrix plot

plot(x=(1:10),y=(2:11), xlab="x", ylab="y")#only dots

plot(x=(1:10),y=(2:11),type="l",lty=4, xlab="x", ylab="y")#only lines

plot(x=(1:10),y=(2:11),type="l",lty=4, xlab="x", ylab="y")#add dots among lines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%% In SAS %%%%%%%%%%%

Ex:

proc gplot data=hw1; *first figure;

.....

run;

proc gplot data=hw2; *second figure;

.....

run;

I do know how to do then?

I have two simple questions.

First, is it possible to autosave the figure by "pdf" file? I reviewed your website http://www.ats.ucla.edu/stat/sas/faq/sasgraphs.htm the title is represented as "How can I save a SAS graph to a gif file? ?". However, I cannot find the solution to this problem.

Second, is it possible to create a subplot in SAS?I hope to put first figure in left panel and the secend figure in the right panel. Like in R, we can use par(mfrow)

%%%%%%%%%% In R %%%%%%%%%%%%%%

par(mfrow=c(1,3))#create a 1*3 matrix plot

plot(x=(1:10),y=(2:11), xlab="x", ylab="y")#only dots

plot(x=(1:10),y=(2:11),type="l",lty=4, xlab="x", ylab="y")#only lines

plot(x=(1:10),y=(2:11),type="l",lty=4, xlab="x", ylab="y")#add dots among lines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%% In SAS %%%%%%%%%%%

Ex:

proc gplot data=hw1; *first figure;

.....

run;

proc gplot data=hw2; *second figure;

.....

run;

I do know how to do then?

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

Posted in reply to deleted_user

04-09-2009 08:27 AM

Investigate using ODS PDF to capture your GPLOT output - visit the SAS support http://support.sas.com/ and use the SEARCH facility or use Google advanced with the argument "save gplot pdf site:sas.com" for topic-related documentation and technical conference papers and sample code snippets.

Scott Barry

SBBWorks, Inc.

Scott Barry

SBBWorks, Inc.

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

Posted in reply to deleted_user

04-09-2009 10:58 AM

Hi:

The web site you referenced is a UCLA web site. Someone there wrote a very nice example. In fact, the answer to how to save your graphic file image to a GIF file -IS- shown:

[pre]

filename outgraph 'e:\temp\mygraph.gif';

goptions gsfname=outgraph dev=gif373;

symbol c=black v=circle h=0.8;

proc gplot data=hsb25;

plot read*math =1;

run;

quit;

goptions reset gsfname=;

symbol c=black v=circle h=0.8;

proc gplot data=hsb25;

plot read*math =1;

run;

quit;

[/pre]

The 2 immediately relevant statements (about creating a GIF file) in this example are the FILENAME statement and the GOPTIONS statement. The FILENAME statement establishes the name of the GIF file and the GOPTIONS statement tells SAS to use that location as the storage location for the graphs generated by the PROC GPLOT steps.

In addition to investigating the SAS documentation on the topic, as Scott pointed out, the SAS web site to search is support.sas.com - -and if you search there, you will find that there are a number of ways to generate plots in panels, depending on which version of SAS you are using.

If you are using SAS 8 or SAS 9.1.3 with SAS/Graph, then PROC GPLOT is how you would create your graphs and then you would use PROC GREPLAY to replay them side by side or in an arrangement of your choosing.

If you are using SAS 9.2, then you could use the above methods or you could also use some of the STAT procedures which automatically produce statistical graphic images, related to your analysis. Then, two of the new procedures related to statistical graph production are the new SGPLOT procedure and the SGPANEL procedures.

One good place to start if you are using SAS 8 or SAS 9.1.3 is this Tech Support document:

http://support.sas.com/techsup/technote/ts659/ts659.html

cynthia

The web site you referenced is a UCLA web site. Someone there wrote a very nice example. In fact, the answer to how to save your graphic file image to a GIF file -IS- shown:

[pre]

filename outgraph 'e:\temp\mygraph.gif';

goptions gsfname=outgraph dev=gif373;

symbol c=black v=circle h=0.8;

proc gplot data=hsb25;

plot read*math =1;

run;

quit;

goptions reset gsfname=;

symbol c=black v=circle h=0.8;

proc gplot data=hsb25;

plot read*math =1;

run;

quit;

[/pre]

The 2 immediately relevant statements (about creating a GIF file) in this example are the FILENAME statement and the GOPTIONS statement. The FILENAME statement establishes the name of the GIF file and the GOPTIONS statement tells SAS to use that location as the storage location for the graphs generated by the PROC GPLOT steps.

In addition to investigating the SAS documentation on the topic, as Scott pointed out, the SAS web site to search is support.sas.com - -and if you search there, you will find that there are a number of ways to generate plots in panels, depending on which version of SAS you are using.

If you are using SAS 8 or SAS 9.1.3 with SAS/Graph, then PROC GPLOT is how you would create your graphs and then you would use PROC GREPLAY to replay them side by side or in an arrangement of your choosing.

If you are using SAS 9.2, then you could use the above methods or you could also use some of the STAT procedures which automatically produce statistical graphic images, related to your analysis. Then, two of the new procedures related to statistical graph production are the new SGPLOT procedure and the SGPANEL procedures.

One good place to start if you are using SAS 8 or SAS 9.1.3 is this Tech Support document:

http://support.sas.com/techsup/technote/ts659/ts659.html

cynthia

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

Posted in reply to deleted_user

05-29-2009 04:20 PM

As for the paneling question, the answer is yes.

If your plots are from a BY group, you can use PROC SGPANEL.

If they are just arbitrary plots of variables from the same data set,

look into using the ODS Graphics Designer which is drag-and-drop (and also can generate the code to create the same plot):

http://support.sas.com/resources/papers/proceedings09/198-2009.pdf

If your plots are from a BY group, you can use PROC SGPANEL.

If they are just arbitrary plots of variables from the same data set,

look into using the ODS Graphics Designer which is drag-and-drop (and also can generate the code to create the same plot):

http://support.sas.com/resources/papers/proceedings09/198-2009.pdf

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

Posted in reply to Rick_SAS

08-05-2009 12:34 PM

If you need to create panels of scatter plots or series plots without classification, you can use PROC SGSCATTER. The Graph Template Langauge (GTL) has the ultimate flexibility for creating ad-hoc panels.