0
votes

Scenario: There is a dataset with a variety of variables sorted by a grouping variable (e.g. region). I would like to split up and output the data into “dashboard” style PDF 1-3 page reports for each value of grouping var (e.g. data on towns, by region).

The first page would contain one or two simple tables with a few key metrics that I want to highlight (e.g. a listing of several towns in the given region with some high-level status indicators, using some font/color formatting to highlight these overall results). Similar to dashboard look but without KPI graphics or anything like that - just a straight-forward, simple table with some key values.

The following 1-2 pages would contain additional data for the towns in the given region, displayed similar to how the data appears in the source dataset (a few additional selected variables, smaller font).

Once the report template/structure is designed, I would like to use it to output PDFs for my source dataset, with separate PDF for each value of a variable (e.g. by region), with PDF file names including region ID. Fancy graphics not a priority.

Questions:

  • Assuming this is doable in SAS/EG. What are some ways of doing this, e.g. PROC REPORT? Options in EG menus?
  • Any suggestions for someone starting out in learning SAS reporting functionality?
  • Resources/template examples you would recommend?
  • Things to consider when trying to transition from an Excel-based report approach to SAS EG / output to PDF approach?

Trying to figure out how feasible something like this would be in contrast to a similar hybrid dashboard-plus-detail type report in Excel, and trade-offs of Excel vs. SAS route. My understanding is SAS offers advantage in the ability to quickly transform/restructure data, something that would be tricky with formula-driven approach in Excel with a relatively large dataset.

I have experience programming in SAS and some experience using EG 5.1. Many thanks!

1
Right now this is not really a good fit for this site. It would work on a more forum-style site, perhaps communities.sas.com. This site expects a more concisely answerable question - you really would need a several page paper to answer this. I would say that you ought to google some, find some papers on SAS Dashboards (they are legion), and try implementing them - then come back with specific questions about implementation, particularly ones accompanied with code and data.Joe

1 Answers

2
votes

Right,

It is doable. There are a few ways to accomplish this task. The way I'd do is:

  • Create your report template. Have a look at ODS markups, Proc report, Proc tabulate, Proc print.
  • Create a lookup table that contains unique combination of of regions/towns
  • Create a macro function that takes your lookup table as input. The macro will generate report.

The ODS will let you break your report by Procs (one proc per page, or a group of procs in single page). Options are numerous.

here is a dummy example:

* Not necessary ;
data _null_;
 wd = pathname('work');
 call symputx('dir',wd);
 put wd;
run;

* create lookup table;
 proc sql;
  create table lkup as select distinct sex from sashelp.class;
 quit;

* create macro definition;
  %macro report(gender);
   ods pdf file="&dir./&gender..pdf" ;
    title Report for group &gender.;
     proc print data=sashelp.class;
      where sex="&gender";
     run;
     proc means data=sashelp.class mean median;
       var weight height;
     where sex ="&gender";
   ods pdf close;
%mend;

* invoke macro using lookup table to generate reports;

data _null_;
 set lkup;
  call execute('%report('||sex||')');
run;

Hope it helps