Data visualization with SAS programming

How to create 1000 graphs quickly, and be able to flip through them with the push of a button?

Reply
New Contributor
Posts: 4

How to create 1000 graphs quickly, and be able to flip through them with the push of a button?

So I have to review about 1000 graphs.  These will be a combination of States and Industries over a 16 year period.

I need line graphs showing dollar amounts spent, across 16yrs, by state and industry.

 

In Excel I use a PivotChart, so a table of Year, State, Industry, Value represent the columns.  I have going through the PivotChart, but really spend about 1 second looking at the graph and 7 seconds bringing up the new one.  Besides a lot of wasted time, I'm getting carpal tunnel. 

 

Ideally if I could have each of these graphs as a slide in Powerpoint I could just run a slideshow and hit the space bar.  Really fast and easy.

 

While I have programmed for quite a while, I know nothing about SAS Graph, ODS Graph, or SAS Visual Analytics, SAS Stat Studio.

 

Can I get some recommendations on how best I can get to a one button solution for reviewing 1000 graphs?

 

Thanks,
Mal

 

Trusted Advisor
Posts: 1,783

Re: How to create 1000 graphs quickly, and be able to flip through them with the push of a button?

ODS HTML ought to work (although it might take a while to load this large HTML file)

 

ODS HTML FILE='graphs.html' path="c:\mydata" gpath="c:\mydata";
proc gwhatever;
...
run;
quit;
ODS HTML CLOSE;
Respected Advisor
Posts: 3,156

Re: How to create 1000 graphs quickly, and be able to flip through them with the push of a button?

As you mentioned that you prefer PPT, so if  you have SAS 9.4, ODS supports native PPT destination, which will give you one-button view.

Super User
Posts: 19,038

Re: How to create 1000 graphs quickly, and be able to flip through them with the push of a button?

The key is making sure your data is in the correct format so that you can ideally specify a BY statement and then, assuming SAS 9.4, output to either PDF or PPT, which you can then just tab through easily.
Respected Advisor
Posts: 4,804

Re: How to create 1000 graphs quickly, and be able to flip through them with the push of a button?

You should also explore SGPANEL to show many graphs on the same page with common axes. It is much easier to compare graphs visually when they are side by side than having to flip pages.

PG
New Contributor
Posts: 4

Re: How to create 1000 graphs quickly, and be able to flip through them with the push of a button?

Thanks guys.

 

I have no experience with ODS Graph, and am pretty horrible macroing.

 

Could someone recommend the best resource where I can learn how to code this, or some pretty close coding examples for creating and exporting all these graphs?  I'm guessing its got a macro loop in it?

 

Thanks again,

Mal

Super User
Super User
Posts: 7,682

Re: How to create 1000 graphs quickly, and be able to flip through them with the push of a button?

There are a few methods you can use, for example from a dataset which has the loop elements:

data _null_;

  set loop;

  call execute('proc sgplot data=have (where=(variable="'||strip(loop_item)||'")); vbox x=x y=y; run;');

run;

 

Or proc template:

proc template;
  define statgraph regress;
    dynamic TICKS ;
    begingraph;
      layout overlay /xaxisopts=(linearopts=(tickvaluelist=TICKS));
        scatterplot x=age y=weight;
      endlayout;
    endgraph;
  end;
run;

proc sgrender data=sashelp.class template=regress;
  dynamic TICKS="11 13 16" ;
run;

If you need some graph coding examples, check this blog: 

http://blogs.sas.com/content/graphicallyspeaking/

 

However, I would of thought that there are far better ways to check data than scrolling through a whole load of graphs manually.  I don't know what you have to check but there a numerous data cleaning techniques which can be applied, upper/lower bounds, windows aggregates (i.e. mean per group on one graph) etc.  

 

 

Ask a Question
Discussion stats
  • 6 replies
  • 409 views
  • 0 likes
  • 6 in conversation