BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
kcvaldez98
Obsidian | Level 7

Hello, SAS coders.

 

I am creating an ODS RTF File and it shows up like this Screen Shot 2023-12-06 at 9.13.32 AM.png

But my code is this:

ODS RTF FILE = "/home/u63558208/Project One/CDPHE Data/5_Results/FinalProject.rtf"
STYLE=BARRETTSBLUE;


TITLE1'Means and Standard Deviations of Demographics, Risk Factors, and Outcomes';
PROC PRINT DATA=COLANLYS.TABLEONE LABEL NOOBS;
RUN;
TITLE;


TITLE1'ANOVA of Demographics, Risk Factors, and Outcomes';
PROC PRINT DATA = COLANLYS.TABLETWO LABEL NOOBS;
RUN;
TITLE;
FOOTNOTE "p-values > .05";
FOOTNOTE;


TITLE1"Pearson's Correlation Between Demographics, Risk Factors, and the Outcome";
PROC PRINT DATA=COLANLYS.TABLETHREE LABEL NOOBS;
RUN;
TITLE;

ODS GRAPHICS ON;
ODS NOPROCTITLE;
PROC SGPLOT DATA=WORK.FIGURE;
VBOX outcomes_adults_mental_distr / CATEGORY=Quartiles FILLATTRS=(COLOR=LIGHTBLUE) BOXWIDTH=0.5;
TITLE BOLD "Boxplot of Quartiles of Marijuana Use and Frequent Mental Distress";
XAXIS LABEL="Quartiles of Marijuana Use" VALUEATTRS=(WEIGHT=BOLD);
YAXIS LABEL="Frequent Mental Distress" VALUES=(0 TO 100 BY 10) OFFSETMIN=0;
REFLINE 70 / AXIS=Y LINEATTRS=(COLOR=BLUE);
REFLINE 90 / AXIS=Y LINEATTRS=(COLOR=BLUE) LABEL="HYPERTENSION THRESHOLD" LABELPOS=max;
YAXIS GRID;
INSET "Data Source: Colorado Study Data"/ POSITION=NW BORDER;
RUN;
TITLE;


ODS NOPROCTITLE;
OPTIONS VALIDVARNAME=ANY;
PROC REG DATA=WORK.FIGURE (RENAME = outcomes_adults_mental_distr = Frequent_Mental_Distress)
PLOTS(ONLY) = FITPLOT;
LABEL Marijuana_Use = 'Percent of People Who Used Marijuana 1+ Days out of 30 Days';
'Linear Regression'n:
MODEL Frequent_Mental_Distress = Marijuana_Use /
CLM
CLI
ALPHA=0.05;

TITLE "Linear Regression of Frequent Mental Distress and Marijuana Use";
ODS SELECT FitPlot;
RUN;
TITLE;

ODS GRAPHICS OFF;
ODS RTF CLOSE;

 

Is there something I did wrong? I am confused it was working before but now it looks like that.

1 ACCEPTED SOLUTION

Accepted Solutions
JosvanderVelden
SAS Super FREQ

Your code looks OK. The image suggests you have opened a pdf file - it starts with %pdf1.5!

 

Can you run the following the code below and see if that produces a correctly formed rtf-file.

ODS RTF FILE = "/home/u63558208/Project One/CDPHE Data/5_Results/test.rtf"
STYLE=BARRETTSBLUE;

Title "Test creating rtf file";
proc print data=sashelp.class(obs=1); run;

ods rtf close;

View solution in original post

5 REPLIES 5
Reeza
Super User
Please show the log as well.
kcvaldez98
Obsidian | Level 7
 
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
69
70 ODS RTF FILE = "/home/u63558208/Project One/CDPHE Data/5_Results/FinalProject.rtf"
71 STYLE=BARRETTSBLUE;
NOTE: Writing RTF Body file: /home/u63558208/Project One/CDPHE Data/5_Results/FinalProject.rtf
72
73
74 TITLE1'Means and Standard Deviations of Demographics, Risk Factors, and Outcomes';
75 PROC PRINT DATA=COLANLYS.TABLEONE LABEL NOOBS;
76 RUN;
 
NOTE: There were 4 observations read from the data set COLANLYS.TABLEONE.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 1568.40k
OS Memory 27812.00k
Timestamp 12/06/2023 04:15:29 PM
Step Count 533 Switch Count 0
Page Faults 0
Page Reclaims 88
Page Swaps 0
Voluntary Context Switches 5
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
 
 
77 TITLE;
78
79
80 TITLE1'ANOVA of Demographics, Risk Factors, and Outcomes';
81 PROC PRINT DATA = COLANLYS.TABLETWO LABEL NOOBS;
82 RUN;
 
NOTE: There were 4 observations read from the data set COLANLYS.TABLETWO.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 766.15k
OS Memory 27812.00k
Timestamp 12/06/2023 04:15:29 PM
Step Count 534 Switch Count 0
Page Faults 0
Page Reclaims 64
Page Swaps 0
Voluntary Context Switches 4
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
 
 
83 TITLE;
84 FOOTNOTE "p-values > .05";
85 FOOTNOTE;
86
87
88 TITLE1"Pearson's Correlation Between Demographics, Risk Factors, and the Outcome";
89 PROC PRINT DATA=COLANLYS.TABLETHREE LABEL NOOBS;
90 RUN;
 
NOTE: There were 4 observations read from the data set COLANLYS.TABLETHREE.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 687.53k
OS Memory 27812.00k
Timestamp 12/06/2023 04:15:29 PM
Step Count 535 Switch Count 0
Page Faults 0
Page Reclaims 71
Page Swaps 0
Voluntary Context Switches 4
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
 
 
91 TITLE;
92
93 ODS GRAPHICS ON;
94 ODS NOPROCTITLE;
95 PROC SGPLOT DATA=WORK.FIGURE;
96 VBOX outcomes_adults_mental_distr / CATEGORY=Quartiles FILLATTRS=(COLOR=LIGHTBLUE) BOXWIDTH=0.5;
97 TITLE BOLD "Boxplot of Quartiles of Marijuana Use and Frequent Mental Distress";
98 XAXIS LABEL="Quartiles of Marijuana Use" VALUEATTRS=(WEIGHT=BOLD);
99 YAXIS LABEL="Frequent Mental Distress" VALUES=(0 TO 100 BY 10) OFFSETMIN=0;
100 REFLINE 70 / AXIS=Y LINEATTRS=(COLOR=BLUE);
101 REFLINE 90 / AXIS=Y LINEATTRS=(COLOR=BLUE) LABEL="HYPERTENSION THRESHOLD" LABELPOS=max;
102 YAXIS GRID;
103 INSET "Data Source: Colorado Study Data"/ POSITION=NW BORDER;
104 RUN;
 
NOTE: PROCEDURE SGPLOT used (Total process time):
real time 0.13 seconds
user cpu time 0.06 seconds
system cpu time 0.02 seconds
memory 15736.25k
OS Memory 40616.00k
Timestamp 12/06/2023 04:15:29 PM
Step Count 536 Switch Count 2
Page Faults 0
Page Reclaims 3677
Page Swaps 0
Voluntary Context Switches 466
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 768
 
NOTE: There were 64 observations read from the data set WORK.FIGURE.
 
105 TITLE;
106
107
108 ODS NOPROCTITLE;
109 OPTIONS VALIDVARNAME=ANY;
110 PROC REG DATA=WORK.FIGURE (RENAME = outcomes_adults_mental_distr = Frequent_Mental_Distress)
111 PLOTS(ONLY) = FITPLOT;
112 LABEL Marijuana_Use = 'Percent of People Who Used Marijuana 1+ Days out of 30 Days';
113 'Linear Regression'n:
114 MODEL Frequent_Mental_Distress = Marijuana_Use /
115 CLM
116 CLI
117 ALPHA=0.05;
118
119 TITLE "Linear Regression of Frequent Mental Distress and Marijuana Use";
120 ODS SELECT FitPlot;
121 RUN;
 
122 TITLE;
123
124 ODS GRAPHICS OFF;
125 ODS RTF CLOSE;
126
127 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

 
JosvanderVelden
SAS Super FREQ

Your code looks OK. The image suggests you have opened a pdf file - it starts with %pdf1.5!

 

Can you run the following the code below and see if that produces a correctly formed rtf-file.

ODS RTF FILE = "/home/u63558208/Project One/CDPHE Data/5_Results/test.rtf"
STYLE=BARRETTSBLUE;

Title "Test creating rtf file";
proc print data=sashelp.class(obs=1); run;

ods rtf close;
Cynthia_sas
SAS Super FREQ
Also, keep in mind that SAS OnDemand for Academics has the ability to automatically create PDF and RTF files, so you will want to turn OFF the automatic file creation. Also, you'll need to find the RTF file created in your OnDemand folder and download it from the OnDemand server to your local machine so you can open the file with Word.
Cynthia
kcvaldez98
Obsidian | Level 7

Thank you everyone, it appears that it is working again.

 

Thank you for all the solutions!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1033 views
  • 4 likes
  • 4 in conversation