My data: Temperatures collected for 5 days, twice a day.

Typical data from a spreadsheet like excel.

Date Temperature
01-Apr-92 45
01-Apr-92 73
02-Apr-92 49
02-Apr-92 75
03-Apr-92 52
03-Apr-92 60
04-Apr-92 39
04-Apr-92 62
05-Apr-92 50
05-Apr-92 72
  1. SAS 6.08 open and running.
  2. Spreadsheet Lotus open and running.
  3. Mark the data on the spreadsheet that you want to transfer (highlight with your mouse) and copy it to the clipboard(right click on your mouse and click on copy).
  4. Move to SAS and select option from the menu bar and then DDE triplet.
  5. Press control insert on the SAS menu and then click on paste to finish the proceedure
  6. You should see FILENAME DAILY DDE " ";
  7. While still in the insert mode click between the 2 quotes above "" and click on paste

Should look something like this when you are finished

FILENAME daily dde '123W|C:\TEMP.WK4!A:B6..A:C15';

with the a:B6..A:C15 being the cells with your data

===========================================================

00005 FILENAME daily dde '123W|C:\TEMP.WK4!A:B6..A:C15';

00006 DATA DAILYTEM;

00007 INFILE DAILY;

00008 INPUT DATE date9. TEMP;

00009 FORMAT DATE DATE9. TEMP;

00010 RUN;

00011 PROC PRINT;

00012 RUN;

00013

===========================================================

Log Output

File Edit View Globals Help

File Edit View Globals Help

NOTE: The infile DAILY is FILENAME=123W|C:\temp   RECFM=V, LRECL=132

The SAS System

 

NOTE: 10 records were read

OBS            DATE            TEMP

The minimum record

1            01APR1992             45

The maximum record 2            01APR1992             73
NOTE: The data set WORK.DA 3            02APR1992             49
NOTE: The DATA statement 4            02APR1992             75
5            03APR1992             52
6            03APR1992             60
7            04APR1992             39
8            04APR1992             62

9            05APR1992             50

11 PROC PRINT;

10           05APR1992             72

12 RUN;
NOTE: The PROCEDURE PRINT

/* Calculate the mean temperature */

Proc Means data=dailytem mean noprint;

var temp;

by date;

output out=meands(keep=date avgtemp)

mean=avgtemp;  

run;

 

/* create a new data set with high, low, and mean values */

data both;

        merge dailyitem means;

        by date;

        run;

 

Finally, we print them.

Proc Print data=both;

run;

 

we now have 2 data sets dailyitems and means so lets send them back to the spreadsheet

  1. Open an Excel spreadsheet this time.

  2. you can follow the above steps to find the DDE but her we know it is going to be:

    'EXCEL | SHEET1 ! R1C1:R10C3'

  3. FILENAME outtemp DDE 'EXCEL | SHEET1 ! R1C1:R10C3'

    DATA datetemp;

    SET both;

    FILE outtemp;

    PUT date temp avgtemp;

    RUN;

     

  4. this will then take and place the data in the first 10 rows and 3 columns of your spread sheet