BookmarkSubscribeRSS Feed
RTelang
Fluorite | Level 6

basically i need a generic macro when called upon to create a report in pdf,rtf,excel & the macro has these parameters--->

  1. indsn – Input Dataset
  2. varlist – List of Variables to be printed. If none then print all variables in the dataset.
  3. report_type – PDF or Excel or RTF. You need to use appropriate ODS statements.
  4. title1 – Title1 of the report
  5. footnote1 – Footnote1 of the report
  6. report_location – Physical location of the report 

how do i further build my code according to my question?

 

data test;
input ID var1 var2 var3 var4;
cards;
1 6 4 4 5
6 5 4 5 5
3 7 9 5 9
7 9 4 8 6
run;

ods pdf file='/folders/myfolders/v.pdf';
proc print data=work.test;
var ID;
run;
ods pdf close;


%macro reportgen(indsn=,varlist=, report_type=, title1=, footnote=, report_location=);
%local i nextword;
%let dsid =%sysfunc(open(&indsn));
%do i=1 %to %sysfunc(countw(&varlist));
%let nextword = %scan(&varlist, &i);
%end;
%mend reportgen;
%macro reportgen(indsn=work.test,varlist=var1 var2 var4,report_type=,title1=,footnote=,report_location);

1 REPLY 1
ChrisHemedinger
Community Manager

Hi @RTelang,

 

I see you have already received several replies to a similar post in the SAS Procedures forum.  While the audience in this ODS/Reporting board might have a few different folks, most of the experts participate in all of the SAS programming related areas on the community.

 

The most helpful responses come when you can share what you've tried and which concepts/syntax you find the most challenging.  The community members are eager to help you to learn, but they don't want to feel treated as contract programmers.

 

If you want to learn/practice programming, may I suggest that you try the resources in SAS Analytics U?  Despite the name, the resources there are free to any learner, not just those enrolled in university.

 

Chris

Manager, SAS Online Communities

SAS Hackathon registration is open! Build your skills. Make connections. Enjoy creative freedom. Maybe change the world.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 1323 views
  • 3 likes
  • 2 in conversation