Unless the HOTLINK option is specified, DDE is performed as a single one-time data transfer. When the HOTLINK option is used and there are multiple cells referenced in the item specification, if any one of the cells changes, then all cells are transmitted. The previous example uses two separate DDE links. It is possible to establish multiple DDE sessions. Once the user completes data entry, typing any character in this field terminates the DDE link: /* Enter data into Excel SHEET1 in */ In this example, a second cell in row 5, column 1 is defined as a status field. Every time the value in this cell changes, the SAS System reads in the new value and outputs the observation to a data set. In the following example, row 1, column 1 of the spreadsheet SHEET1 contains the daily production total. If no data have changed, the HOTLINK option returns a record of 0 bytes. In addition, DDE enables you to poll the data when the HOTLINK option is specified to determine whether data within the range specified have been changed. If the HOTLINK option is specified, the DDE link is activated every time the data in the specified spreadsheet range are updated. * After performing this DATA step, column1*/ * ('09'x) between each variable, as in */ * You can use the NOTAB option to store */ To store the entire string, including embedded blanks in a single cell, use the NOTAB option as in the following example: /* Without the NOTAB option, column1 */ For example, if a link is established between the SAS System and the Excel application, and a SAS variable contains a character string with embedded blanks, each word of the character string is normally stored in a single cell. The NOTAB option also can be used to store full character strings, including embedded blanks, in a single spreadsheet cell. When the NOTAB option is placed in a FILENAME statement that uses the DDE device-type keyword, the SAS System accepts character delimiters other than tabs between variables. Similarly, the SAS System places a TAB character between variables when data are transmitted across the link. The SAS System expects to see a TAB character placed between each variable that is communicated across the DDE link. The spreadsheet is then saved and the Excel application is terminated. In the following example, the Excel application is invoked using the X command a spreadsheet called SHEET1 is loaded data are sent from the SAS System to Excel for row 1, column 1 to row 20, column 3 and the commands required to select a data range and sort the data are issued. You can issue commands to Excel or other DDE-compatible programs directly from the SAS System using DDE. Using DDE and the SYSTEM Topic to Invoke Commands in an Application Using Excel filename testit dde 'winword|"c:\temp\testing.doc" This example reads data from a Microsoft Word document at a given bookmark. Using DDE to Read Data from Microsoft Word You can also use DDE to read data from an Excel application into the SAS System, as in the following example: /* The DDE link is established using */ Using DDE to Read Data from Microsoft Excel If the PUT statement contains a macro that Word97 does not understand, you will see this message: Ambiguous name detected: TmpDDE Note: If you are writing to Microsoft Word97, use Visual Basic commands such as FileOpen.Name, FileSave, FileClose, and Insert. filename testit dde `winword|"c:\temp\testing.doc" Note the difference between using DDE with Microsoft Word and Microsoft Excel. This example sends a text string to a Micorosft Word document at a given bookmark. Using DDE to Write Data To Microsoft Word * through 100 and columns 1 through 3 */ To do this, submit the following program: /* The DDE link is established using */ The target cells are rows 1 through 100 and columns 1 through 3. The first example sends data from a SAS session to an Excel spreadsheet. Using DDE to Write Data To Microsoft Excel X 'excel' /* you might need to specify */ The XWAIT and XSYNC options must be turned off. Note: DDE examples are included in the host-specific sample programs that you access from the Help menu.Ī DDE server application can be opened using the X command within SAS code. These examples use Microsoft Excel and Microsoft Word as DDE servers, but any application that supports DDE as a server can communicate with the SAS System.īefore you run these examples, you must first invoke Microsoft Excel and Microsoft Word, and open the spreadsheet or document used in the example. This section provides several examples of using DDE with the SAS System under Windows.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |