Date: Tue, 3 Feb 1998 12:24:37 -0600
Reply-To: AL TAN <ALBERT@MARKETPROBE.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: AL TAN <ALBERT@MARKETPROBE.COM>
Subject: Re: DATA _NULL_ and PUT Statement
Content-Type: text/plain; charset="us-ascii"
Suhua:
For your question one, there are two methods. First, you can write the
DATA _NULL_ result to a file. You can then refer the file in PROC
GPRINT with a virtual filename. Here you need to rewrite the goptions
for the device = driver part by specifying a custom CGM driver to
PowerPoint. Check out the Tech Support (I can't remember which issue)
that teaches you to customize the driver. Second, you can write your
output to EXCEL through DDE. There are a lot of discussion on this
list. Keep in mind that when you investigate the first method,
SAS/GRAPH is required.
To get move your decimal point in the output, use the format as follows:
format rate 6.2;
The result should be 0.50.
To get right-justified results, you may use the RIGHT() function in
conjunction with your put statement.
Albert
>-----Original Message-----
>From: Suhua Hu [SMTP:sxh04@HEALTH.STATE.NY.US]
>Sent: Tuesday, February 03, 1998 10:48 AM
>To: SAS-L@VTVM1
>Subject: DATA _NULL_ and PUT Statement
>
>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.
|