Hey all,
working with SAS university, Mac OS.
Only recently I learned about ods rtf and I managed to add various text sections and by ods listing to create images. Before I used the word-button in the result tab in SAS, which automatically generates a .rtf file.
Now I've got following assignment:
"Generate a dataset, with 25 observations, from a triangular distribution (you choose the value for the single argument h, and keep this same h value for all three plots), and plot the histogram using proc univariate.
Do this again with n=250, and then with n=2500.
Indicate (in a title) what value of h you have chosen, and what the sample size is on each of the three plots"
My solution:
ods tagsets.rtf file="/folders/myfolders/question2_&td_mv..rtf" style=journal2 startpage=no
options(doc="help" tables_off="Usertext");
ods escapechar="^";
ods noproctitle;
data _null_;
call symput ("today_mv", trim(put(today(), weekdate29. -l)));
call symput("td_mv", trim (put(today(), date9. -l)));
run;
footnote1 height=8pt font=arial "Report generated on &today_mv";
ods tagsets.rtf text="^S={font_face='arial' fontsize=12pt color=blue}
^2n Histogram Assignment";
ods tagsets.rtf text="^S={font_face='arial' fontsize=12pt color=darkblue}
^2n 2. Question ^S={font_face='arial' fontsize=10pt}
^2n a) Generate a dataset, with 25 observations, from a triangular distribution,
and plot the histogram using proc univariate.
^n Do this again with n=250, and then with n=2500.
^n Indicate (in a title) what value of h you have chosen,
and what the sample size is in each of the resulting distribution?";
%macro a(B);
data D1;
call StreamInit(1);
n = &B;
do id = 1 to n;
x = rand('triangle',0.5);
output;
end;
drop n;
run;
proc univariate NoPrint data=D1;
Title "Histogram of triangular distribution with h = 0.5 and n =" &B;
histogram x/normal;
inset n = "N:"(5.0) mean = "Mean:"(5.2) std = "Std Dev:"(5.2) / pos = nw;
run;
ods tagsets.rtf startpage=now;
%mend a;
%a(25);
%a(250);
%a(2500);
ods tagsets.rtf close;
My issues (see attached rtf file):
1. noprint statement works only for the very first graph (with n=25). The following graphs have all the data I don't want to have in the output.
2. The title for the first graph "Histogram of triangular distribution ..." is placed above the first rtf text section instead of directly above the non existing graph beyond the rtf text.
4. My browser language is German. My rtf output is German. Change of locale=de_DE to locate=en_En is not working at all. So, sorry for that.
My unsuccessful attempts:
- style changes
- ods graphics on/off
- ods listing gpath
- title, proctitel, different positions
Now I am desperate and don't know what to do ... pulling out my hair already, next step would be to throw the laptop out of the window.
Please help!
Happy news to myself!
I solved problem No1 - and it is so simple. Only thing I had to do was to close and reopen the finder to actualize the files...
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.