Can someone help me on how to add text to the graph that is generated by gplot procedure? I would like to add some statistics as the text highlighted in yellow from other procedures for better understanding.
Thanks.
Related
I've searched and searched, but I can't seem to find a solution.
I'm on 8.2 Update 4 (8.2.4.1261) (32-bit).
Can someone help me export a table into an Excel file with multiple sheets?
Example: Table contains a list of USA professional sports teams (with their city/nickname and league they are in). Each tab would be separated by league (NBA, MLB, NFL, NHL, MLS). How would I go about this?
I'd also like to add the current date to the output Excel file name. From what I've read, I can create a variable with the sysdate. Just not sure how to incorporate it in the code.
Each sheet name is to be based on a group.
In SAS we use the BY statement to specify the variable(s) that form a group -- in your case, it is the one variable league
The BY statement makes special tokens available during output, #BYVAR<n> and #BYVAL<n>
You want the value of the league to be important (sheet name) during output so #BYVAL1
ODS EXCEL sheet name construction is specified in the OPTIONS option. You can use the BY token in the option.
You want ODS EXCEL ... OPTIONS (sheet_name="#BYVAL1") ...;
A BY statement in output procedures produces an extra line <BYVAR>=<BYVAL> which would be noise in your Excel output.
Prevent the noise with OPTIONS NOBYLINE;
Example:
ods excel file='output.xlsx' options(sheet_name="#BYVAL1");
options nobyline;
proc print noobs data=sashelp.cars;
by make;
run;
ods excel close;
Produces
More
If you want the BY variable to appear in the PROC PRINT output use a VAR _ALL_; statement, or list the columns wanted explicity.
Adding the BY variable to the output will make things easier if you need to import and combine data that was edited in Excel, or if you are making various charts and such. In reality you might be better of producing a single worksheet with all the data and then using autofilter (which is an ODS EXCEL option) and Excel pivot tables/charts if you are doing other work in Excel. (Proc TABULATE and REPORT can do a very large subset of what pivot tables can do.)
Here is another issue I'm facing with SAS:
I have to write a full paper/report in SAS and can't find how to do so. So I already have a multitude of coding (to clean the data, create some new variable, merge three datasets, etc etc etc. I also made some tables and a few plots in the whole process). Now what I need to do for the project is: Write a scientific paper of a only a few pages (introduction, methodology, results, discussion, ...) in SAS. (I think the teacher said something about ods text ="blablabla..." to insert the text.) And of course use some of the tables/plots from my previous coding in this. This paper should be exported into a pdf file.
I was thinking of using
ODS TRACE ON;
...
ODS TRACE OFF;
for the tables I made (code for the creation of the tables is between those two lines of code). But then I just don't understand how I can re-use this output later on when creating my pdf-paper with:
ODS PDF FILE ='c:\...'
...
ODS PDF CLOSE;
I was hoping I could just 'trace' all of the tables and plots I needed in my code. And than open this pdf file, add some titles, some text, some of the tables/plots in between the text, and close the pdf file. However, I have a bad feeling it isn't as simple as that. :'(
Thanks in advance!
I have an excel file I want to create from a PROC REPORT step, using ODS TAGSETS.ExcelXP and an adjusted version of the style MINIMAL. I want to have the first column in the output to have white borders (so it doesn't look like it has a border) while the rest of the columns have the black border from MINIMAL still.
I have been trying all day to do it but alas, no success! It is either changing all the borders, or none.
I have tried using
proc template to edit the minimal style
style=[bordercolor=white] and all variants to change borders (eg. borderleftcolor etc.)
style(column)=[bordercolor=white] where this and the one above were tried all over the place in proc report (as a proc report style, as a define style).
Please help! :(
An example output would be like below:
Example Output
I'm using SAS for the first time and am unable to find out how to display parameter estimates for a regression analysis in table format. Currently it just spits out fixed-width text in the output window.
Any help would be appreciated, thanks!
Lots of ways to do this. The easiest is to use HTML as your output destination. The results will then be displayed in an HTML table.
ods html; *Turns on the HTML output. Look at SAS doc on how to set styles, locations, etc;
<your code here>
ods html close; *Turns off the HTML output;
Is it possible to generate a simple tree with values at each node in SAS? I'm looking to create something simple like this:
I was interested in doing something similar a while back - printing a folder tree to the output area. I wasn't able to find a dedicated SAS proc that would work this way. The only method I know of that would allow you to create something like this (with quite a lot of effort) would be to write a macro to generate all the lines and captions in an annotation dataset, and then generate an image from it using proc ganno or proc gslide. See here for further details on using annotation datasets.