BookmarkSubscribeRSS Feed
Yul
Obsidian | Level 7 Yul
Obsidian | Level 7

Hi 

How can I use variables that I have in the data in the title2? 

Is it possible to define something like that?

 

ods rtf file="Z:\yy\xx\zz\Outputs\130621\%sysfunc(compress(&Subject)).rtf" newfile=none startpage=no

record_separator=none BODYTITLE Style=Custom;

ODS ESCAPECHAR='^' ;

title1 '^S={preimage="Z:\yy\xx\logo.jpg"}';

Is it possible to enter here variables from /*2**/?

proc report data = Analysis.b Style=Styles.Custom nowd split='^' nocenter ;

column Subject ;

define Subject /display style(column)={just=center cellwidth=1.4 in} "Subject Number" ;

where Subject="&Subject";

run;

 

 

/*2**/

proc sort data=analysis.gg ; by Subject PHONDAT; run;

proc report data =analysis.gg Style=Styles.Custom nowd split='^' nocenter style(report)={borderwidth=.5pt cellspacing=0pt cellpadding=0pt};

column PHONDAT_RAW PHVISYN SCCSYN LSTCNTYN1;  

define PHONDAT_RAW /display style(column)={just=center cellwidth=0.5 in} "Contact Date";

define PHVISYN /display style(column)={just=center cellwidth=0.5 in} "Was telephone visit performed?";

define SCCSYN /display style(column)={just=center cellwidth=0.8 in} "Was Contact successful?";

define LSTCNTYN1 /display style(column)={just=center cellwidth=1 in} "Is this the last telephone contact? ";

where Subject="&Subject" ;

title ‘Follow-up';

run;

 

ods rtf close;

ods listing;

%mend;

7 REPLIES 7
tarheel13
Rhodochrosite | Level 12

What if you just make a macro variable and use that in your title statement?

Yul
Obsidian | Level 7 Yul
Obsidian | Level 7

Hi,

Could you please write how to do it?

Thanks

 

ChrisNZ
Tourmaline | Level 20

Please use the appropriate button to paste code.

 

Not too sure what you want to write, but this is one way:

data _null_;
  set ANALYSIS.GG(obs=1);
  call execute(catx(' ', 'title2 "', SUBJECT, '-', PHONDAT, ' "; ' );
run;

Add this step after the title1.

Yul
Obsidian | Level 7 Yul
Obsidian | Level 7

hi,

I tried your solution. but, it shows dates like 'Phondat' as a number and also I want to see it as a table with columns and labels and not only display of variables. 

 

Yul
Obsidian | Level 7 Yul
Obsidian | Level 7

Is it possible to locate this table in the header of every page in the report?

Treatment

start date

status

End date

 

28APR2020

 

17MAR2021

 

ChrisNZ
Tourmaline | Level 20

For an HTML output, you'd simply add the desired HTML tags in the title.

title1 'Report';
title2 '<table width="445px">
<thead>
<tr>
<td width="110.703px">
<p><strong>Treatment</strong></p>
</td>
<td width="110.82px">
<p><strong>start date</strong></p>
</td>
<td width="101.445px">
<p><strong>status</strong></p>
</td>
<td width="120.781px">
<p><strong>End date</strong></p>
</td>
</tr>
</thead>
<tbody>
<tr>
<td width="110.703px">
<p>&nbsp;</p>
</td>
<td width="110.82px">
<p>28APR2020</p>
</td>
<td width="101.445px">
<p>&nbsp;</p>
</td>
<td width="120.781px">
<p>17MAR2021</p>
</td>
</tr>
</tbody>
</table>';
ods html file='%temp%\test.html';
proc print data=SASHELP.CLASS(obs=2);
run;
ods html close;

ChrisNZ_0-1624505415788.png

 

I suppose RTF can do something similar, but I don't know RTF syntax.

 

ChrisNZ
Tourmaline | Level 20

This works for RTF too actually.

title2 '{\header\pard\plain\qc{
\trowd\trkeep\trhdr\trql
\clbrdrt\brdrs\brdrw15\brdrcf1\clbrdrb\brdrs\brdrw5\brdrcf1\clbrdrl\brdrs\brdrw15\brdrcf1\cltxlrtb\clvertalb\clcbpat17\clpadt60\clpadft3\clpadr60\clpadfr3\cellx1158
\clbrdrt\brdrs\brdrw15\brdrcf1\clbrdrb\brdrs\brdrw5\brdrcf1\clbrdrl\brdrs\brdrw5\brdrcf1\cltxlrtb\clvertalb\clcbpat17\clpadt60\clpadft3\clpadr60\clpadfr3\cellx2291
\clbrdrt\brdrs\brdrw15\brdrcf1\clbrdrb\brdrs\brdrw5\brdrcf1\clbrdrl\brdrs\brdrw5\brdrcf1\cltxlrtb\clvertalb\clcbpat17\clpadt60\clpadft3\clpadr60\clpadfr3\cellx2977
\clbrdrt\brdrs\brdrw15\brdrcf1\clbrdrb\brdrs\brdrw5\brdrcf1\clbrdrl\brdrs\brdrw5\brdrcf1\clbrdrr\brdrs\brdrw15\brdrcf1\cltxlrtb\clvertalb\clcbpat17\clpadt60\clpadft3\clpadr60\clpadfr3\cellx4178
\pard\plain\intbl\keepn\b\sb60\sa60\ql\f1\fs22\cf1{Treatment\cell}
\pard\plain\intbl\keepn\b\sb60\sa60\ql\f1\fs22\cf1{start_date\cell}
\pard\plain\intbl\keepn\b\sb60\sa60\ql\f1\fs22\cf1{status\cell}
\pard\plain\intbl\keepn\b\sb60\sa60\ql\f1\fs22\cf1{End_date\cell}
{\row}
 
\trowd\trkeep\trql
\clbrdrb\brdrs\brdrw15\brdrcf1\clbrdrl\brdrs\brdrw5\brdrcf1\cltxlrtb\clvertalt\clcbpat8\clpadt60\clpadft3\clpadr60\clpadfr3\cellx1158
\clbrdrb\brdrs\brdrw15\brdrcf1\clbrdrl\brdrs\brdrw5\brdrcf1\cltxlrtb\clvertalt\clcbpat8\clpadt60\clpadft3\clpadr60\clpadfr3\cellx2291
\clbrdrb\brdrs\brdrw15\brdrcf1\clbrdrl\brdrs\brdrw5\brdrcf1\cltxlrtb\clvertalt\clcbpat8\clpadt60\clpadft3\clpadr60\clpadfr3\cellx2977
\clbrdrb\brdrs\brdrw15\brdrcf1\clbrdrl\brdrs\brdrw5\brdrcf1\clbrdrr\brdrs\brdrw15\brdrcf1\cltxlrtb\clvertalt\clcbpat8\clpadt60\clpadft3\clpadr60\clpadfr3\cellx4178
\pard\plain\intbl\sb60\sa60\ql\f1\fs20\cf1{\cell}
\pard\plain\intbl\sb60\sa60\ql\f1\fs20\cf1{08APR2020\cell}
\pard\plain\intbl\sb60\sa60\ql\f1\fs20\cf1{\cell}
\pard\plain\intbl\sb60\sa60\ql\f1\fs20\cf1{07MAR2021\cell}
{\row}
}
}'; 

ods rtf file='%temp%\test.rtf';  
proc print data=SASHELP.CLASS(obs=2) noobs; run;
ods rtf close;

ChrisNZ_0-1624509472671.png

 

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 7 replies
  • 763 views
  • 0 likes
  • 3 in conversation