BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Niugg2010
Obsidian | Level 7

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)

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
Diamond | Level 26

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

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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?

Niugg2010
Obsidian | Level 7

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.

Cynthia_sas
Diamond | Level 26

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

Niugg2010
Obsidian | Level 7

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. 

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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