Help using Base SAS procedures

grapic questions

Reply
N/A
Posts: 0

grapic questions

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?
Super Contributor
Super Contributor
Posts: 3,174

Re: grapic questions

Posted in reply to deleted_user
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.
SAS Super FREQ
Posts: 8,868

Re: grapic questions

Posted in reply to deleted_user
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
SAS Super FREQ
Posts: 3,753

Re: grapic questions

Posted in reply to deleted_user
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
SAS Super FREQ
Posts: 939

Re: grapic questions

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.
Ask a Question
Discussion stats
  • 4 replies
  • 219 views
  • 0 likes
  • 5 in conversation