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)
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
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?
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.
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
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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.