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
SAS Super FREQ

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
SAS Super FREQ

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. 

 

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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