After you install copy-selection.xpt, try issuing these commands:
vt sashelp.class execcmd=common.viewtable.customcommand.scl:handler select some rows or columns issue custom command COPY_SELECTION paste into Excel or desired application
This SCL is designed to be installed as common.viewtable.customcommand.scl
The COPY_SELECTION command was implemented in SCL after reading this posting on SAS-L
From: Charles Patridge Newsgroups: comp.soft-sys.sas Subject: "COPY and PASTE" SAS Values Message-ID: <200111071726.fA7HQBD119368@listserv.cc.uga.edu> Date: 7 Nov 01 17:26:11 GMT
I am running SAS V8.2 on Windows NT desktop.
I create a SAS dataset and open it up using ViewTable.
I would like to highlight a few rows and columns and "copy" these values into another application such as Excel without using "IMPORT".
Instead, it wants to copy these records I highlighted and append them to the file I have opened.
So can you do this (copy and paste sas values from VIEWTABLE window) in SAS V8.2 to another application???
I thought "copy and paste" would work but no can do.
Thanks for any help.
I know I can save the file permanently and then use the SAS System Viewer to "copy and paste" but was hoping that I would not have to go to the extra trouble of creating a permanent SAS dataset just to "copy and paste".
The copy and paste functionality you want is not built into viewtable. However, that does not mean it can not be done.
In version 8.2, the execcmd= option of the viewtable command now works correctly. This option allows one to indicate an SCL entry that will be 'installed' to handle custom commands issued in the viewtable window. There is an online help document on how to do this. In the online help (not doc) in the index tab, enter "EXECCMD Argument" to learn more.
With that in mind, here is an SCL method that will work for selection modes allowed by viewtable: one set of contiguous rows [all columns]) or multiple sets of contiguous columns [all rows]. [On my system, any interior selection of a block of cells is immediately unselected when the mouse button goes up.] The SCL has not been tested with tables having thousands of rows. Once the SCL is compiled, you can issue this command:
vt sashelp.class execcmd=common.viewtable.customcommand.scl:handler
select some rows or columns
issue custom command COPY_SELECTION
paste into Excel
Place this SCL at catalog entry common.viewtable.customcommand.scl and compile.
<SCL code snipped>
|Copy from SAS ViewTable
|to Word (followed by menu Table /
Convert Text to Table...)