The SAS Output Delivery System and reporting techniques

ODS and template question

Accepted Solution Solved
Reply
Contributor
Posts: 66
Accepted Solution

ODS and template question

I put the below code. Why are there no data print out?

 

 

data ab;
input a1-a5 b1-b5;
datalines;
1 2 3 4 5 101 102 103 104 105
6 7 8 9 10 106 107 108 109 110
11 12 13 14 15 111 112 113 114 115
;
run;

%MACRO render(template, dataset);
DATA _NULL_;
SET &dataset;
FILE PRINT ODS=(TEMPLATE="&template");
PUT ODS;
RUN;
%MEND render;


PROC TEMPLATE;
DEFINE TABLE mytable;
COLUMN a1-a5 b1-b5;
END;
RUN;


%render(mytable,ab)


Accepted Solutions
Solution
‎10-29-2016 06:35 AM
SAS Super FREQ
Posts: 8,745

Re: ODS and template question

[ Edited ]

Hi:
Before you "macroize" anything, you should test it outside of macro to see if it works. When I run only your PROC TEMPLATE code and DATA step code, I get errors.

I assume you got this error too:
NOTE: Variable ODS is uninitialized.

Just to begin with, your PUT statement is incorrect. It should not be
PUT ODS;

The correct syntax is PUT _ODS_ -- please refer to the doc or to this paper: http://www2.sas.com/proceedings/sugi30/088-30.pdf

cynthia

View solution in original post


All Replies
Super User
Super User
Posts: 7,433

Re: ODS and template question

What is it your trying to do, to display the dataset in the output window you would simply put:

data ab;
  input a1-a5 b1-b5;
datalines;
1 2 3 4 5 101 102 103 104 105
6 7 8 9 10 106 107 108 109 110
11 12 13 14 15 111 112 113 114 115
;
run;

proc print data=ab;
run;

I don't understand why you have all that other code?

Contributor
Posts: 66

Re: ODS and template question

I want to use the template on my table. Before I do that I want to check if this way does work or not. So here I give a simple example.

Solution
‎10-29-2016 06:35 AM
SAS Super FREQ
Posts: 8,745

Re: ODS and template question

[ Edited ]

Hi:
Before you "macroize" anything, you should test it outside of macro to see if it works. When I run only your PROC TEMPLATE code and DATA step code, I get errors.

I assume you got this error too:
NOTE: Variable ODS is uninitialized.

Just to begin with, your PUT statement is incorrect. It should not be
PUT ODS;

The correct syntax is PUT _ODS_ -- please refer to the doc or to this paper: http://www2.sas.com/proceedings/sugi30/088-30.pdf

cynthia

Contributor
Posts: 66

Re: ODS and template question

Cynthia,

 

       Thanks. You are right. I also got some errors. I am sure it is ods's reason. However, I am not sure how to use "put" with ODS. Thanks for your response and the suggested document. It is really helpful. 

 

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 348 views
  • 1 like
  • 3 in conversation