Date: Thu, 10 Jan 2008 20:26:59 +1300
Reply-To: Robin Templer <templerr@CLEAR.NET.NZ>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Robin Templer <templerr@CLEAR.NET.NZ>
Subject: Re: What is the SAS command to open the 'View in Excel' pop menu
item
In-Reply-To: <CA07286C39A1939186CD0206@[10.8.2.178]>
Content-type: text/plain; charset=us-ascii
Thanks to Dave & Andre - I ended up writing my own to allow me to customize
the structure of the tables.
Cheers
Robin
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Dave
Scocca
Sent: Wednesday, 9 January 2008 4:28 a.m.
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: What is the SAS command to open the 'View in Excel' pop menu
item
Robin Templer wrote:
> Running under Windows, SAS 9.1.3 Sp4, and I want to programmatically
> run the item 'View in Excel'. The 'View in Excel' is a pop up menu item
> displayed when you right mouse click on a SAS dataset in the SAS Explorer
> window.
>
> Does any one know what the underlying command is ? I know I could
> re-invent that - but I am lazy.
OK--the generalized case of how to find the underlying commands for
Explorer menu items:
(1) Choose Tools... Options... Explorer
(2) Go to the "Members" tab
(3) Select "Table"
(4) Click "Edit..."
You will see a list of available actions and action commands. Selecting one
and using the "Edit..." button lets you copy the exact command string,
which in this case is:
AFA C=SASHELP.EXPLORER.EXCEL_TABLE_OPEN.SCL LIBRARY='%8b' TABLE='%32b';
where:
AFA (short for AFAPPLICATION) is the command to run an AF or SCL program
nonexclusively--that is, allowing you to continue using other SAS features
or run other programs while the AF/SCL program runs
C=SASHELP.EXPLORER.EXCEL_TABLE_OPEN.SCL specifies a SAS-provided SCL
program to open the table in Excel. ("C=" is short for "CATALOG=".)
%8b represents the library name of the selected table
%32b represents the member name of the selected table
A note: the catalog SASHELP.EXPLORER contains SCL entries with source code,
so you can actually look at SASHELP.EXPLORER.EXCEL_TABLE_OPEN.SCL to see
what it does.
(In this case, I can't help but think that the way it works is very
strange: it uses PROC PRINT with ODS HTML to put a dataset listing into an
HTML file with an .XLS extension, and then uses WINEXECFILE to open the
file in Excel.)
Dave Scocca