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 (February 1998, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 3 Feb 1998 13:55:30 -0800
Reply-To:   "William W. Viergever" <wwvierg@IBM.NET>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   "William W. Viergever" <wwvierg@IBM.NET>
Subject:   Re: DATA _NULL_ and PUT Statement
Comments:   To: sxh04@HEALTH.STATE.NY.US
In-Reply-To:   <199802031649.AA23099@gate1.health.state.ny.us>
Content-Type:   text/plain; charset="us-ascii"

At 11:48 AM 2/3/98 EST, Suhua Hu wrote: >Hi SAS-Lers, > >I have the following data set and would like to write it out to >Microsoft Office Power Point. I got most of it done using DALL _NULL_ >and PUT satement, but still have some problems which I don't know how >to fix. I would be greatly appreciate it if somebody can help me out. > >The data set looks like: > >id number yes rate cum_n cum_yes cumrate lift > 1 4 3 0.75 4 3 0.75 0.15 > 2 3 1 0.33 7 4 0.57 0.04 > 3 4 2 0.50 11 6 0.55 0.00 > >Here is my program: > >data _null_; > set one end=last; > file print notitles header=pagetop; > if _n_=1 then do; > totnum=0; > totyes=0; > totcumn=0; > totcumy=0; > end; > put @10 id @16 number @22 yes @28 rate @36 cum_n @42 cum_yes > @49 cumrate @57 lift; > totnum+number; > totyes+yes; > totcumn+cum_n; > totcumy+cum_yes; > if last then > do; > put / > @3 'Total' > @16 totnum @22 totyes @28 rate @36 totcumn @42 totcumy > @49 cumrate @57 lift; > end; > return; > pagetop: > put @17 'Whatever title you like to use'// > @09 'Id' @13 'Number' @21 'Yes' @28 'Rate' @34 'Cum_n' > @41 'Cum_yes' @49 'Cumrate' @57 'Lift'/; > return; >run; > >The output look like: > > Whatever title you like to use > > Id Number Yes Rate Cum_n Cum_yes Cumrate Lift > > 1 4 3 0.75 4 3 0.75 0.15 > 2 3 1 0.33 7 4 0.57 0.04 > 3 4 2 0.5 11 6 0.55 0 > > Total 11 6 0.5 22 13 0.55 0 > >Three difficulties: > >(1) How to write it to MSOffice Power Point or at leat Excell directly > instead of saving the output and importing it from Power Point > >(2) How to get 0.50 or 0.00 instead of 0.5 or 0 > >(3) How to right justify the numberic variables such as number, cum_n > and cum_yes > >Thanks again. > >

1) Use DDE to Excel and have that "linked" to your Power Point presentation (BTW: if you go this route you can do without all the SAS-totals gathering and simply put out Excel formulas as text strings in the "if last then do" loop).

2) Use formats in your put statement, e.g., >

put @10 id 2. @16 number 2. @22 yes 2. @28 rate 6.2 @36 cum_n 2. @42 cum_yes 2. @49 cumrate 6.2

Note: I've used 2. for the numerics, you may need wider, however, your rates will now have 2 decimal places. Also, if you go into Excel, it's Excel whose formatting will determine what is displayed (hence format your Excel sheet after you've DDE-d data into it and then clear its contents and save this "template", thus for later DDE's, it will be formatted already).

3) See above, i.e., I'd do the right-justifying in Excel not SAS since that's the formattinf that will drive Power Point. If you're hung up on doing in SAS, then I believe you'd need to convert the numerics to characters and then go from there.

Ciao' for now.

/*=====================*/ W. W. Viergever Viergever & Associates Sacramento, CA (916) 923-2355 /*=====================*/


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