Date: Tue, 8 Jan 2008 10:28:20 -0500
Reply-To: Dave Scocca <dave@SCOCCA.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Dave Scocca <dave@SCOCCA.ORG>
Subject: Re: What is the SAS command to open the 'View in Excel' pop menu
item
In-Reply-To: <478332FF.20303@ined.fr>
Content-Type: text/plain; charset=us-ascii; format=flowed
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