BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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?
4 REPLIES 4
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.
Cynthia_sas
SAS Super FREQ
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
Rick_SAS
SAS Super FREQ
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
DanH_sas
SAS Super FREQ
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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1096 views
  • 0 likes
  • 5 in conversation