BookmarkSubscribeRSS Feed
Lacona
Quartz | Level 8

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! 

 

2 REPLIES 2
Lacona
Quartz | Level 8

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... 


Lacona
Quartz | Level 8
So, it seems that I answer my questions myself....

I managed to use ods rtf instead of ods tagsets.rtf (there was a typo in the file path!), so I was able to add bodytitle. With bodytitle the titles were positioned on top of the corresponding table/graph - except the very first one. That one stays displaced and I don't know why.
Anyone have an idea about that?

The solution for the non-working noprint statement is, that it can't suppress certain tables. My code for the histogram included a normal curve. When I deleted that, I had only the graphs without any data as output.

What I also can't figure out is, what command I have to add to the text passages for indented lines. ^ S={indent=.12in} won't work and ^S={just=center} centers the text in the left corner instead in the center of the page.
Any ideas to solve this?

Thank you!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 691 views
  • 0 likes
  • 1 in conversation