Is proc toolbar a hidden procedure? - sas

I got it by chance.
Submit this to SAS:
proc toolbar;
quit;
The Log says:ERROR: Unable to open ..., I think it indicates proc toolbar is some kind of procedure but I just didn't use correct syntax. Because if there is not a procedure named toolbar it would be another kind of hint: ERROR: PROCEDURE XXX not find. You can validate it using the following example.
proc XXX;
quit;
I dont't find any documents about proc toolbar. How do you know about it? could you please share with me?

Currently, custom toolbars for SAS display manager sessions are created using the display manager command TOOLDEF and loaded (or attached) to a window using command TOOLLOAD.
Proc TOOLBAR may be a deprecated or an abandoned experimental procedure that is for programmatically creating custom toolbars.
As for
ERROR: Unable to open ...
The mystery of what ... is remains.
Attempts to specify a procedure option produces a log message
ERROR 22-322: Expecting ;.
So maybe the procedure does not allow options.
The procedure does process an ITEM statement that was likely the syntax for associating an entry with a command and icon
item <name> command="<command>" icon=<icon-number>
Every attempt to run Proc TOOLBAR will create a new temporary catalog in the WORK folder.
proc toolbar cat=work.play.one;
item work command="dir work" icon="123";
item view command='viewtable &syslast';
quit;
Aside for icons
The SAS display manager command regedit raises the SAS registry editor window. Icon numbers for various classifier mnemonic can be seen in the drill path SAS_REGISTRY/CORE/CLASSIFIERS and for SAS explorer at SAS_REGISTRY/CORE/EXPLORER/ICONS. The SAS registry editor does not display the icon image that corresponds to the icon number.
Example:
Classifier 100 is named COPYITEM and will show icon #173 in the display manager UI. The datatype of the names are strings as shown by the preceding [ab] icon.
However, you can download and run an improved registry viewer application built with SAS/AF that does show icon images adjacent to icon numbers.
See page "SAS/AF Registry Browser" for information about the viewer application. The viewer can be installed and run by submitting
LIBNAME EXAMPLE "%sysfunc(pathname(WORK))";
filename INSTALL
URL "https://www.devenezia.com:443/downloads/sas/af/example/registry-browser/registry-browser.xpt"
;
PROC CIMPORT LIB=EXAMPLE FILE=INSTALL;
RUN;
filename INSTALL;
proc display cat=EXAMPLE.REGISTRY.BROWSER.FRAME;
run;
Other interesting artifacts from bygone days
Proc PMENU
SAS Explorer use and customization

There are a number of procs in SAS that are dead/defunct. They are normally very hard to find info on. A few years ago, with some sleuthing, I got proc explode to work. An old procedure to write large letters on greenbar back in the mainframe printer days. I am sure there are many, many more. I think I remember proc toolbar but has been 20+ years. Maybe an AF proc when SAS was on the old editor.
Honestly, I would ignore it as having any value. I suspect dozens of abandoned procs in the code base.

Related

SAS : ODS and code highlighting

When using R markdown for making statistical reports, I have the ability to echo the R code in my output document. I'm learning SAS and I was wondering if it was possible to highlight or echo the SAS code in my final ODS report ? I'm using a dirty hack right know to display the code in my document, which is using "ods text = ", but it seems quite redundant. Plus it doesn't add syntax highlighting.
That feature does not exist in the SAS language right now, but it has been mentioned in several talks by Amy Peters, principal product manager of the SAS programing environments, as a planned feature for a near-future SAS release (with no specific date yet, but hopefully in the next 2 years). It would likely be implemented in a similar fashion to Jupyter Notebooks, in that you write your code and get your output inline.
That said, SAS does support Jupyter Notebooks, which is the best current (third party) solution. Contact your SAS administrator for more information.
I have an idea here, I'm the type of guy who dosent take no for answer and find a way to fiddle and get it done... but i think this is abit far fetch... you can try still I think it will work with mostly evrything but may have a hard time to play with quotes when you have multiple semi colomns....
Check:
I started by creating a dumbass dataset :
data tata;
x=1;
run;
then we do the following:
%let code= select * from tata;
proc sql;
create table report as
&code.;
quit;
proc print data=report;
footnote "&code.";
run;
The rationale:
I think it you put your code in macrovariables and then execute those macro variables you would be able to print show the code after by printing the macrovariable following your text...
See the sample

Display webout HTML generated by data steps in a SAS Web Report Studio

Here is how I build reports for SAS EnterpriseGRC:
I write sas base or macro code to collect and process data using
procs and data steps.
Then I use file _webout; in data steps and use
put statements to generate html
Then I register this code as a stored process and define filters which I am already handling in the code.
And then I navigate to Reports tab in EGRC and wala I have a report
For example my code would look like:
proc sql noprint;
CREATE TABLE work.risks AS
SELECT *
FROM opdetail.risk_L;
quit;
data _null_;
file _webout;
put '<html>';
put '<body>';
put '<table>';
put '<tr><td>Risk ID</td><td>Risk RK</td></tr>'
run;
data _null_;
set work.risks;
put '<tr>';
put '<td>'; put risk_id;'</td>'
put '<td>'; put risk_rk;'</td>'
put '</tr>';
run;
data _null_;
put '</table>';
put '</body>';
put '</html>';
run;
Now this is a very simplistic approach but a very effective one since I can theoretically represent my data in any complicated form like a correlation heat etc, as much as HTML allows
Now this technique has only one problem. Clients have a problem printing this report from within EGRC. The code I have written produces a stream output so I cant use this STP in a SAS Web Report Studio report where printing options are available. How can I solve my printing problem in the least complicated way?
p.s I know can build Informationmaps and build reports like they are supposed to but sometimes clients request demands a format of report which SAS Web Report Studio can not handle.
I could put this Print This Page in the HTML, but that puts date and page title on the top of printing page which is out of my control.
Well the least complicated way was to put a javascript print function through HTML inside the report. Though if someone IS still looking for a proper solution than ODS is the answer
Well the simplest way to print your _stream'd html report is via your trusty web browser!
Simply navigate to www.YOURSASMIDTER/SASStoredProcess and select "List Available Stored Processes and Reports". When you find your STP, right click and open in a new tab.
You now have your html report, and the URL which can be shared with end customers - who can apply your registered filters, and print your report in their browser of choice.
Of course this is not a the recommended way to build web based reports with SAS. Your SAS code will get overcomplicated by many / complex put statements (mixing SAS code with html/css/javascript). You will also struggle to apply the thousands of excellent libraries that can jazz up your report (such as highcharts, handsontable, d3).
If you are happy to deliver your reports purely from the browser (instead of EGRC) then a suggested / more scaleable approach is to use the open source SASjs adapter. More info at https://sasjs.io

SAS 9.4 does not scroll Output window with new output

In SAS 9.4, I am sending using the Output window with the Listing preference. The window, however, does not automatically scroll to show new output. For example, if I first do a proc print, the output will show up on the first page of the Output window. If I do an additional proc print, the Output window remains on the first page and does not automatically scroll down to show the second proc print results. There must be a preference that I am not setting correctly, but haven't figured it out. Thanks in advance for your suggestions/solutions.
djohns
Thanks for the comments.
This problem was resolved by setting Tools->Options->Preferences->Results by checking 'Create Listing', unchecking 'Create HTML', and checking 'View Results as they are Generated'. It seems like I did this several times.
I'm not sure that this was necessary, but I also set Tools->Options->Output->Display Autoscroll to 'PAGE', and checked 'PAGE MODE'.
Now when I do a Proc, the output goes to the Output window and the Output window pops to the front showing the page with the latest output.

Turn off automatic graph saving in SAS 9.4

In SAS 9.3, I could use ODS HTML GPATH to specify the path where I wanted graphs to be saved (if I so desired). In 9.4, by default (i.e. every time I open SAS) whenever I make a graph (with PROC SGPLOT, e.g.), it automatically saves the plot to the location where the SAS program is saved. I've tried going to Tools --> Options --> Preferences --> Results and unchecking every combination of the HTML and ODS options, but no matter what I'm still getting automatically saved graphs. How can I turn this off? Preferably I'd still have ODS output within SAS, but I do not want these PNG (or whatever) images to be saved to my computer outside SAS automatically.
EDIT: More information because the differences as stated above were not clear.
1) In 9.3 I had to say ODS GRAPHICS ON and specify ODS HTML GPATH in order to have SAS save my plots to my computer outside of SAS (or so I thought). If I wanted ODS graphics inside of SAS, but not save graphs outside of SAS, I could just say ODS GRAPHICS ON and skip the ODS HTML GPATH statement.
2) When I open 9.4 and do not make any statements about ODS (i.e. leave settings at default), but run a procedure such as SGPLOT, I A) get both a html graph (ODS graph that shows up in SAS's 'Results' window) and a graph that I can double-click to open in Windows Photo Viewer, and B) the plot is additionally and automatically saved where my SAS program is located as a PNG.
Trying to stop this automatic graphing saving, I have tried the following in SAS 9.4 before running PROC SGPLOT:
1) ODS GRAPHICS OFF: Nothing changes. I still get everything listed in point (2) above.
2) ODS HTML CLOSE (with ODS GRAPHICS ON): Lose html/ODS version of graph within SAS, but still have graph in SAS I could double-click that opens in Windows Photo Viewer, and still the graph saves automatically to my SAS program's location.
3) ODS GRAPHICS OFF and ODS HTML CLOSE: Same thing as previous case ((2) directly above).
What I want (and I feel like this is how it was in 9.3) is to yes, have ODS graphs come up within SAS (don't really need the version you can double-click to open in Windows Photo Viewer), but no, do not have SAS save a PNG to my computer (specifically, my SAS program's location).
First off, a few notes about what you tried.
ODS GRAPHICS on/off will not have any real effect on SGPLOT or any of the SG procedures; they are all ODS GRAPHICS no matter what. What it does affect is PROC UNIVARIATE and similar procedures that have two types of graphics - old style graphics and ODS GRAPHICS. ODS GRAPHICS ON tells them to use ODS GRAPHICS, and OFF tells them to use the older method.
ODS HTML CLOSE will tell SAS not to produce HTML output, but as long as you have another destination open (ODS LISTING?) it will produce graphs still to the GRAPH destination. Addtionally, the fact that it still produces graphics at all with ODS HTML CLOSE (as opposed to the note "No output destinations active" and no output) tells me you still have a destination open (again, probably LISTING). Thus, ODS HTML GPATH will not necessarily solve your problem (as it will only impact where the HTML output will go). You need to set GPATH for each open destination (which is either LISTING, HTML, or both, depending on the checkboxes in your preferences).
The solution:
Since you want it to go away, your best bet is to make it in your work directory (which is cleaned up by SAS when it properly shuts down).
ods listing gpath="%sysfunc(getoption(work))";
proc sgplot data=sashelp.class;
vbar sex;
run;
Note that the .png files are created (as they always are), but now they go into the work catalog (which you can browse like a sub-library and see each of the files inside).
You could put the initial line in an autoexec.sas file and tell SAS to run that when SAS starts up (-AUTOEXEC option on command line).
You also could uncheck Listing in tools->preferences->Results, and/or use ODS LISTING CLOSE;, and those files should not appear.
Go to Tools --> Options --> Preferences --> Results and uncheck Create listing. It should take care of the automatic saving of PNG files to your program files.
In 9.3, when ODS HTML is on, graphs are defaulted to the user's home directory. They are saved to the hard drive, even if you don't specify a path. Otherwise, there is no way for the browser to display the images. The default location may have moved in 9.4 (I don't have a copy to test), but both versions put png files on your hard drive.

how to Setting VIEWTABLE to show column names in SAS?

Problem Description:
when viewing a sas table in VIEWTABLE, the header for each column is default to show column description, how do I make it show column name instead?
I am using SAS version:9.3
What I did so far:
I found the following solution online (This solution was tested on SAS 9.2)
VT SASHELP.VCOLUMN COLHEADING=NAMES
when I run this command I was given the following error
8713 VT SASHELP.VCOLUMN COLHEADING=NAMES
--
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
The point and click version of the solution did not work for me either.
That is a dm command, so you need to submit it to DM:
dm 'VT SASHELP.VCOLUMN COLHEADING=NAMES';
You could also assign that command (what you have, in mine just the part within the quotes) in KEYS ('keys' in the command bar). You also can do this on a case by case basis in the VIEW menu once you've opened the dataset.
The way to do this permanently:
Open the Explorer (View -> Explorer)
Tools->Options->Explorer
Select Members
Select Table, Edit
Select &Open, Edit
Add COLHEADING=NAMES to the end of the string already present (should be something like VIEWTABLE %8b."%s".DATA COLHEADING=NAMES after you finish).
Save everything (OK to all dialog boxes).
This will only persist if save settings on exit is enabled in the preferences (tools-options-preferences) and this is not an rsasuser session (read-only access to user profiles).