BookmarkSubscribeRSS Feed
dal233
Calcite | Level 5

I've got a macro that iterates through the variables in a dataset and outputs a table with various responses and other summary statistics.

So, for example, one variable might be year and the table generated by proc tabulate would look like this:

Year     Exposure     Frequency     Loss

2008     10423          0.1               5469    

2009     45390          0.12             4987    

2010     100542        0.2               29801

Many tables like this are generated for variables other than year and the results are formatted and outputted to a pdf.

My question is how can I accompany the tables with plots in the pdf.  In the example above I would like to output the table and then above the table a plot of Year against frequency as a line chart, with year on the x-axis and frequency on the y-axis.  I would like to do the same thing for every other variable that gets outputted from the proc tabulate procedure to the pdf.

Any ideas or pointers from anybody?

2 REPLIES 2
Cynthia_sas
SAS Super FREQ


Hi:

  You have 2 choices for graphing: SAS/GRAPH (PROC GPLOT) or ODS GRAPHICS (PROC SGPLOT with a SERIES or a VLINE statement). If you are using EG, you can generate the GPLOT code easily from within the Graph Wizard. If you are in SAS 9.2/9.3, you can try the ODS GRAPHICS DESIGNER to build your graphs in point and click fashion. If you are using code for the TABULATE and you want to use code for the image, then you will need to decide which method you want to use.

  If you are new to SAS and new to coding and you are at SAS 9.3, I'd recommend using PROC SGPLOT, as it is probably less verbose code-wise than GPLOT. There are LOTS of SGPLOT examples in user-group papers and on the web. Here are a few to get you started. The references section at the back of each paper lists a bunch of other papers.

http://support.sas.com/resources/papers/proceedings11/294-2011.pdf

http://support.sas.com/resources/papers/proceedings12/261-2012.pdf

  Have fun with graphing!

cynthia

dal233
Calcite | Level 5

Thank you.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2 replies
  • 3586 views
  • 1 like
  • 2 in conversation