BookmarkSubscribeRSS Feed
ChristosK
Quartz | Level 8

I've been trying to recreate and improve upon a  figure I had created in sas studio as an RFT file.

Can't seem to get it to look the same in sas base:

 

It seems to work, but not the way expected it.
 
The new figure has:
 
1) Broken lines for the Confidence Intervals. This only occurs above the dotted line between Statin and pre Na. I don't want these breaks.
2) CI lines are wider and fuzzier at the edges.
3) There are supposed to be three dotted lines.
 
 
4) I only get png's saved automatically when running this. Previously I was able to get rtf's as word compatible documents that were high re
refline 1.0 / axis=x discretethickness=1 lineattrs=(color=cxd0e0f0);
  refline 'preNa' / axis=y discreteoffset=0.5     lineattrs = (pattern=dot color =black) ;
  refline 'pRBC' / axis=y discreteoffset=0.5    lineattrs =(pattern=dot color =black);
  refline 'AoXCmin' / axis=y discreteoffset=0.5 lineattrs =(pattern=dot color =black) ;
solution oor pdf's.
 
Any idea on how to get publication quality graphs from this? I took out the title at the request of the reviewer and he wants a keynote instead.

 

libname Heerdt "C:\Users\Christos Koutentis\Desktop\SAS Files\Heerdt";

proc contents data = HEERDT.vp_table2b2 varnum;
run;

proc format;
value $Namefmt 
"Age"          ="Age"
"BMI"          ="BMI"
"Sex_num"      ="Sex (Male)"
"CABG_i"       ="CABG isolated"
"Valve_i"      ="Valve isolated"     
"CABG_V"       ="CABG / Valve"      
"OHT"          ="Heart Transplant"
"Redo1"        ="Redo"   
"IABP_ever1"   ="Hx of IABP"      
"Hyperlip"     ="Hyperlipidemia" 
"NIDDM1"       ="NIDDM" 
"COPD"         ="COPD" 
"CHF"          ="CHF" 
"Afib"         ="Afib" 
"CM"           ="Cardiomyopathy" 
"CAD"          ="CAD" 
"MI"           ="Hx of MI" 
"AICD"         ="AICD" 
"CRF"          ="Renal Failure" 
"PVD"          ="PVD" 
"ASA"          ="Aspirin" 
"BB"           ="Beta Blockers" 
"Steroids"     ="Steroids"
"Amio"         ="Amiodarone" 
"LMWH"         ="LMWH" 
"Digoxin"      ="Digoxin" 
"AA1"          ="Alpha Antagonists" 
"Statin1"      ="Statins"
"Nitrates1"     ="Nitrates " 
"Diurectics1"  ="Diuretics" 
"pre_Na"       ="preop Na" 
"pre_BUN"      ="preop BUN" 
"pre_Cr"       ="preop Cr" 
"pre_Gluc"     ="preop Gluc" 
"pre_Neutro"   ="preop Neutrophils" 
"pre_Lymph"    ="preop Lymphocytes" 
"pre_Hgb"      ="preop Hb" 
"pRBC"         ="PRBC"
"FFP" 		   ="FFP"
"PLT"          ="Platelets"
"Cryo"         ="Cryoprecipitate"
"CPBmin"       ="Bypass time"
"AoXCmin"      ="Cross Clamp time"
"Ind_Temp1"    ="induction Temp(C)"
"Ind_HR1"      ="ind HR"
"Ind_SBP1"     ="ind SBP"
"Ind_MAP1"     ="ind MAP"   
"Ind_DBP1"     ="ind DBP"  
"Ind_PAS1"     ="ind PAS"  
"Ind_mPAP1"    ="ind mPAP"  
"Ind_PAD1"     ="ind PAD"   
"pulse_p"      ="ind pulse pressure"
"A"            ="."
"B"            ="."
"C"            =".";
run; 

proc template;
   define style mystyle;
   parent=styles.sasweb;
      class graphwalls / 
            frameborder=off;
      class graphbackground / 
            color=white;
   end;
run;

ods listing close;
ods html style=mystyle path='.' file='newgraph.html';
ods graphics / reset=all border=off width=800 height=900;





/* formatted */
/* $Namefmt */
/* Using this one but formats do not come out as required, and we did not get the spaces between sections. */
proc sgplot data =HEERDT.VP_Table2b2  nowall noborder ;
/* Title "OR (95% CI) across Vasoplegia Severity, units=1 s.d." ; */
styleattrs datacontrastcolors=(CX18577A CX30CC6E  ) ;
format Name $Namefmt.;
scatter x=sdOR y=Name / xerrorupper=sdUCL xerrorlower=sdLCL noerrorcaps markerattrs=(symbol=circlefilled size =5 ) 
group=Severity groupdisplay=cluster clusterwidth=0.6;
yaxis DISCRETEORDER= DATA reverse ;
xaxis display =(noticks  nolabel noline) VALUEATTRS=(Color=Black Family=Arial Size=8 Style=Normal Weight=Normal)type =log logbase =10 ;
yaxis display =(noticks nolabel noline) VALUEATTRS=(Color=Black Family=Arial Size=8 Style=Normal Weight=Normal)
valueshalign=left colorbands=odd colorbandsattrs=(transparency=0.7);
refline 1.0 / axis=x discretethickness=1 lineattrs=(color=cxd0e0f0);
  refline 'preNa' / axis=y discreteoffset=0.5     lineattrs = (pattern=dot color =black) ; 
  refline 'pRBC' / axis=y discreteoffset=0.5    lineattrs =(pattern=dot color =black);
  refline 'AoXCmin' / axis=y discreteoffset=0.5 lineattrs =(pattern=dot color =black)  ;
yaxistable pdp2_char sdORCI /class =Severity classdisplay =stack position=right location=outside 
VALUEATTRS=(Color=Black Family=Arial Size=8  Weight=Normal ) VALUEHALIGN=CENTER VALUEJUSTIFY= CENTER CLASSORDER=reversedata    
COLORGROUP=Severity; 
 xaxis display=(nolabel) values=(0.4 1.0 1.5 2.0 2.5 5);
 keylegend /title ="OR (95% CI) across Vasoplegia Severity, units=1 s.d." location=outside;
run;

Dataset is included.

5 REPLIES 5
Reeza
Super User
You can wrap your code in ODS statements to get your output as RTF or Word. Or go to preferences and select WORD as an output format. I prefer ODS because then you control exactly the file that you create and there's no extraneous items.

Are you using the same version of SAS?
Are you using the same type of images (JPG, SVG, PNG), I don't see where you specify the image type anywhere?
ChristosK
Quartz | Level 8

Using SAS 9.4 TS level 1M6 on X64_10PRO platform.

I dont remember much about running ODS statements as I been away from SAS for whilst. How do you even start doing this?

I guess somewhere in ODS you have an opportunity to specify the type of output.

ballardw
Super User

You code shows creating HTML output:

ods html style=mystyle path='.' file='newgraph.html';

Which is basically going to produce PNG graphic files.

 

If you are attempting to create an RTF document I would expect to see something like

ods rtf file='c:\path\file.rtf' style=mystyle;

You may need to use the IMAGE_DPI= option with the RTF if the resolution seems fuzzy. Add: IMAGE_DPI=300 to the ODS RTF (or HTML) statement to create 300 dots per inch resolution, or experiment. HTML defaults to 96 and may be fuzzy.

 

Of do you intend to create a specific image file type? That is the ODS GRAPHICS / outputfmt= option. RTF would want and OUTPUTFMT=EMF.

 

You haven't actually described what is "different" from your SAS Studio to the given output.

One likely cause is the STYLE which controls all the basic graphic appearance items. If your definition of MYSTYLE is not exactly the same as for the Studio version code, then things will look different.

If your MYSTYLE is derived from another style there may be differences in inheritance between two version of SAS as there could be minor differences in the same style between versions. (Got bit by thi

 

 

ChristosK
Quartz | Level 8

Figure 1.rtf is what I had submitted to the journal.

They wanted me to remove the title and just put in that information and other annotation as a keynote.

ballardw
Super User

@ChristosK wrote:

Figure 1.rtf is what I had submitted to the journal.

They wanted me to remove the title and just put in that information and other annotation as a keynote.


For most of the ODS destinations the option NOGTITLE will not place a title in the graph. If you do not want any title then use

 

Title;

to clear any title statements before the output.

 

Without more explicit information I couldn't say how to place "that information and other annotation as a keynote". If it is only text then perhaps Proc ODSTEXT called after the graph.

Maybe something like:

proc odstext;
p "My title text"/ style=[fontsize=16pt fontstyle=italic];
p "Some other text to display after the graph"/ style=[fontsize=12pt];
run;

just to show some style control over the paragraph of text. P is "start of paragraph" here.

You might want the ODS option STARTPAGE=NEVER so the above output comes immediately after the graph.

Or perhaps FOOTNOTE statements would work as well.

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
  • 5 replies
  • 554 views
  • 2 likes
  • 3 in conversation