LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2000, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 25 Jan 2000 07:34:15 -0500
Reply-To:   Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject:   Re: Help with macros, excel 97 and SAS 6.12
Content-Type:   text/plain; charset=US-ASCII

You could use a macro but you don't have to. The alternative is to write everything to the same range and use "System" commands to repeatedly SaveAs.

Here is some typical code (fragmentary). EXCELSIC is a SAS data set and PATH is a SAS macrovariable.

filename outdata dde 'excel|sheet1!r1c1:r300c7'; filename commands dde 'excel|system';

data _null_; set excelsic; by sic; file outdata notab; if first.sic then do; [some PUT statements] end; [more PUT statements] ; if last.sic then do; [more PUT statements] * Output buffer flush necessary to fill spreadsheet before saving to disk; put '!DDE_FLUSH'; file commands; length excelcmd $ 200; excelcmd = '[SAVE.AS("' || "&PATH\sic\" || substr(sic,1,2) || '.xls",1,"",FALSE,"",FALSE)]'; put excelcmd; end; run;

As explained in a very recent thread, the Excel v. 4 macro language, not VBA, is the supported command set.

In my paper "Getting Started with Dynamic Data Exchange" (http://www.ita.doc.gov/industry/otea/dcsug/ddepaper.pdf) I have an example of generating multiple worksheets.

-----Original Message-----

Date: Mon, 24 Jan 2000 21:56:27 GMT From: stephno1@MY-DEJA.COM Subject: Help with macros, excel 97 and SAS 6.12

The situation is this..

I have a dataset with about 50 subjects each with an id number. For each subject there are from 1 to several observations. I have a SAS program to do some computations on the observations. Now I need to write a macro that will...

take each subject, put their specific info into excel on their very own worksheet and label the tabs by the id number

I am writing an Excel macro to take the information and make some nice graphs per each worksheet.

I know how to tell SAS to output things to excel...

filename out dde 'Excel|[filename.xls]worksheet!beginning cell:ending cell'; data dataset; set dt.dataset; file out notab; run;

I would appreciate any help.

Sent via Deja.com http://www.deja.com/ Before you buy.


Back to: Top of message | Previous page | Main SAS-L page