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

Hello,

 

I am using PROC PSMATCH to generate a standardized mean difference plot. I want to output the plot to an RTF file, but everytime I do that, there is an additional title of "The PSMATCH Procedure", which I want to remove (see screenshot).

 

I tried using ODS NOPROCTITLE, but the "The PSMATCH Procedure" still outputs to my RTF file. Is there a way to remove "The PSMATCH Procedure"? 

 

Below is some sample code:

ods noproctitle;

ods rtf file="C:\standardized_mean_diff_plot.rtf";

title font="calibri" height=12pt justify=left bold "Standardized Mean Difference Plot"

ods graphics on / reset noborder width=1000px height=1000px imagefmt=jpg;
ods select StdDiffPlot;

proc psmatch data=psdata region=cs;
	class GROUP AGE SEX;
	psmodel GROUP(Treated="Cases")= AGE SEX;
	match method=optimal(k=1)
			distance=lps
			caliper=.
			weight=none;
	assess lps var=AGE SEX;
run;

ods graphics off;

ods rtf close;
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

You could post process the text file that ODS RTF creates and remove that string.

Change your Original ODS RTF statement to write to a temporary file.

filename rtf temp;
ods rtf file=rtf;

Then after closing the RTF destination copy the temp file to the target file and remove that string along the way.

data _null_;
  infile rtf;
  file "C:\standardized_mean_diff_plot.rtf";
  input;
  _infile_=tranwrd(_infile_,'{The PSMATCH Procedure\cell}','{\cell}');
  put _infile_;
run;

View solution in original post

9 REPLIES 9
Cynthia_sas
SAS Super FREQ
Hi:
This is not just something that happens with ODS RTF output. I see the same procedure title with ODS HTML output. It was my understanding that ODS NOPTITLE would suppress the procedure title, but this is clearly not the case. I'm not sure whether this is new behavior in SAS 9.4 M7 or not. This somthing that should be reported to SAS Tech Support for them to weigh in on whether this is a defect or whether Ksharp's idea of changing the procedure template would work.
Cynthia
andreas_lds
Jade | Level 19

Could be a bug or special feature. I don't see any reason why proc psmatch should not be affected by "ods noproctitle". Just copied one of the examples from the docs, using Enterprise Guide 8.3 and html as default output destination, "ods noproctitle" seems to have no effect on the output, i still see the title "Proc PSMatch". Contacting tech-support is recommended.

Ksharp
Super User
I think OP need PROC TEMPLATE to modify the template of PROC PSMATCH, especially for ENTRYTITLE statement in PROC TEMPLATE .
andreas_lds
Jade | Level 19

@Ksharp wrote:
I think OP need PROC TEMPLATE to modify the template of PROC PSMATCH, especially for ENTRYTITLE statement in PROC TEMPLATE .

Yes, this could be a  solution, but i still think it is a bug, that proc psmatch seems to ignore the ods option.

Tom
Super User Tom
Super User

You could post process the text file that ODS RTF creates and remove that string.

Change your Original ODS RTF statement to write to a temporary file.

filename rtf temp;
ods rtf file=rtf;

Then after closing the RTF destination copy the temp file to the target file and remove that string along the way.

data _null_;
  infile rtf;
  file "C:\standardized_mean_diff_plot.rtf";
  input;
  _infile_=tranwrd(_infile_,'{The PSMATCH Procedure\cell}','{\cell}');
  put _infile_;
run;
ble9245
Fluorite | Level 6

Hi Tom,

 

Apologies for the late reply - even though this is not the easiest solution, it works! I'll have to contact tech support to see if there's a better way, or if they can get the ods noproctitle glitch fixed. Thanks for your help!

Tom
Super User Tom
Super User

Just be careful if the lines in the RTF file are ever longer than 32K bytes then this approach will have trouble.

 

There are ways to do this by treating the file as binary, but that takes a little more complex coding.  The essential idea is to read in the file in blocks of characters.  Each time you read a new block you concatenate it with the previous block, replace the string, split it back into two and write the previous block to the target.  Make sure to write the final block.  So you are essentially moving a two block window across the file to catch the cases where the string you are searching happened to be split across two blocks.  The block size needs to be large enough to fully include the search term and short enough that you can concatenate two blocks into one character variable.  So less than 16K bytes per block.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 9 replies
  • 982 views
  • 7 likes
  • 5 in conversation