BookmarkSubscribeRSS Feed
Tanguy
Calcite | Level 5

Dear SAS community,

 

I am using SAS EG to build reports in HTML. In the GUI, I have the possibility to add a title to my report. Do you know if it is possible to use a macro variable for the title? I indeed have to create tens of reports, and it is a bit bunrdensome to write manually the title for each report generated.

 

In advance, thank you,

6 REPLIES 6
TomKari
Onyx | Level 15

Personally, I think that EG is the ideal tool for code development, and for one-off exploratory analytics.

 

In your case, of operationalizing a repetitive action, I think you might be happier if you used the EG facilities to create a "model" of your reporting process, but then capture the code and create your process in code, either in EG or in one of the production-oriented tools like DIS. Then, you'll have full access to all of the automation, macro, and scheduling facilities that you might require.

 

Tom

Tanguy
Calcite | Level 5
Thanks Tom for your answer,
Do you know how to extract the code for the report generation? I couldn't find a tab code as displayed in the query builder, this is my issue.
Thank you very much and kind regards,
Tanguy
TomKari
Onyx | Level 15

Yes, those sneaky devils (that's YOU, @ChrisHemedinger), made it a little different in Query Builder.

 

Get your query set up just the way you need, and then click the Preview button. That will show you the generated code.

 

Tom

k_o
Fluorite | Level 6 k_o
Fluorite | Level 6

Then, once you have the code you like for your report from the GUI, you can customize the titles to include whatever macro variable you would like.  here's an example that inserts the report date into a title:

 

data _null_; /* define report date macro variable as two days ago */
call symput('rpt_date',put(date()-2,date9.)); 
run;
%put &rpt_date;

TITLE1 JUSTIFY=left "Here's the overall report title.";
TITLE3 JUSTIFY=center "Particular report on &rpt_date.";

proc report data=infile;
run;
title; /* clear titles with blank title statement or update title for next report */

 

Tanguy
Calcite | Level 5

Thanks a lot Tom for your time,

Nevertheless I did not manage to find the code...

For the query builder I can find it (preview, or open the table and click on the tab 'code'. But for the 'report' functionality (File<New<Report...), the preview button does not show any code, just the chart.

I fear that the code cannot be accessed...

TomKari
Onyx | Level 15

My apologies, I thought you were asking about the Query Builder.

 

No, I don't know how to access the facilities that create reports in EG. I've never used this part of the product.

 

Hopefully, someone else will be able to give some good suggestions!

 

Best,

  Tom

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 6 replies
  • 1418 views
  • 1 like
  • 3 in conversation