Hello, colleagues. I'm responsible for randomization, and, in particular, coding. The task I have to complete is to create 2 huge word documents with each page in them serving as a label to be printed later on with the intention to glue it on a cover of an envelope or to be used as the contents of an envelope. This particular study uses envelopes for randomization. The first document should be like this: each page should have text in the middle with name of the study and whatnot and then the next line would be just the "Envelope number: x The second document is a bit diffferent: 3 lines in the middle, first line is just the study name, second line is randomization number and third line is the kit number. In my disposal I got a data set X with 2 columns (randnum, kitnum) and 150 rows. First column is randomization number and second column is the kit number. The idea I had in mind was to use the %do-loop inside a macro after an "ods rtf file" statement, which would, using a data step, fetch a row of the data set X and then using ods rtf text statement with the startpage = now I'd be able to create the desired document: The code would look like this: %macro M;
local i;
%do i = 1 %to 150;
data temp;
set x;
where _N_ = &i;
call symput('randnum',randnum);
call symput('kitnum',kitnum);
run;
ods rtf text "to-be-redacted-when-code-works: &randnum, &kitnum); /* many other lines to make the pages look approproate */
%end;
%mend M;
options nodate nonumber byline;
ods escapechar = "^";
ods listing close;
ods rtf file = "<my_destination_folder>" startpage=no;
%M;
ods _all_ close;
ods listing;
But sadly the result fails and the myriad of errors tell me that I either do not understand the %do-loop statement or ods rtf statements simply do not work for this purpose. Could anyone help out to point at the errors or suggest a viable alternative? Thanks in advance.
... View more