I'm sure I'm not thinking of the correct keyword for searching, but I cannot find the answer to this simple question: How do I write text at then end of my output? For example, say my output consists of tables and at the end I want to write (in words) a summary of the results of that table.
I understand that I would have to go back and re-run the program after I find out what the results are, but what statement do I use, and where do I include it, so that the text is written at the end of the output? I do not want to write a footnote because that will be printed at the bottom of each page.
I work in the Windows environment (v. 9.4) and I import my data so I don't know how I could include it in the data step.
Thanks!
Are you using an ODS destination?
You can look into ODS TEXT="your string..."
Another option, is to look at using a Jupyter Notebook which helps with this type of format.
http://blogs.sas.com/content/sasdummy/2016/04/24/how-to-run-sas-programs-in-jupyter-notebook/
Hi, thanks for the reply!
I'm not using an ODS destination. I looked at that but it seems too complicated for me! I also looked at the Jupyter site -- it is definitely over my head! I may have a Ph.D. but (unfortunately) it is not in any subject closely related to computers. I'm a fish out of water here. What I'm hoping to do is to print my results, including a summary, to a file (pdf, I guess -- that's what I know how to do) and put in Dropbox for my coauthors to look over. I'll probably just have to do it the old fashioned way, but I thought I'd give this a shot first.
Thanks again for taking the time to respond!
Here is it. Thanks for the help!
libname rvsp 'C:\users\hay\desktop\rules vs principles paper\r vs p justification paper\';
filename rvsp1 'C:\users\hay\desktop\';
options linesize=80;
proc import datafile = 'C:\users\hay\desktop\rules vs principles paper\r vs p justification paper\SASDATASETJUST.xls' out=RVSP.data121416f;
data new; set RVSP.data121416f;
That code just imports data. No analytical results.
You need to be using ODS, it'll save you time in the long run. Or yeah, copy and paste.
ODS PDF file='sample.pdf' style = meadow;
Title 'PDF Results';
proc REG data=SASHELP.class plots=(diagnostics residuals);
model weight = height age;
run;quit;
ods PDF close;
When you create a report, using:
proc print / proc report / proc tabulate and probably more other procedures
you can add text:
- using title1 to title10 - comming before the report body
- using footnote1 to footnote10 - comming at the end, that is after the report body
Titles and footnotes should precede the procedure that creates the report body
And in both you can insert '~n' to break the line into sublines - but that
needs ODS escapechar = '~n'; to precede the above lines code.
Hi Shmuel,
Thanks so much for the input!
I just now responded to the comment before yours and I may have solved the problem in my own "non-SAS" way!
Thanks again for the help!
Okay, I understand now. I've included it below.
I'm just running a simple program with 57 data points. I use SAS because I analyze the data in several different ways and since I have unequal cell sizes, it's more accurate than SPSS. I was thinking there might be a statement I was missing -- like "title" or "footnote" --that would allow me to add general text at the end. Actually, this conversation may have helped me solve my problem in another way. At some point, I mentioned that I plan to save the output as a pdf file. I should be able to add text to the pdf file. That may well be the easiest way to approach this.
Thanks again for your help (even if using the pdf file is the easiest way to go). Maybe SAS will add a "endnote" statement in the future for something like this.
libname rvsp 'C:\users\hay\desktop\rules vs principles paper\r vs p justification paper\';
filename rvsp1 'C:\users\hay\desktop\';
options linesize=80;
proc import datafile = 'C:\users\hay\desktop\rules vs principles paper\r vs p justification paper\SASDATASETJUST.xls' out=RVSP.data121416f;
data new; set RVSP.data121416f;
proc sort;
by agreei rp;
proc glm;
class agreei rp;
model istmts = agreei|rp;
means agreei rp agreei*rp;
title 'Inventory';
title2 '# of Agreement/Disagreement Statements';
title3 'Disagreed (0)/Agreed (1) with Client Treatment';
title4 'Principles (1)/Rules (2) Conditions';
title5 '22101 21215 22205 22116 deleted';
run;
quit;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.