Date: Thu, 21 Sep 2006 13:28:22 -0400
Reply-To: "data _null_;" <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_;" <datanull@GMAIL.COM>
Subject: Re: Column values in Labels
In-Reply-To: <200609211625.k8LEbNfE027711@mailgw.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
This seems like a reasonably close approximation to what you are
trying to do. I guess the PROC REPORT experts are all busy elsewhere
at this time. When they get freed-up they can give you the real
solution.
Please post more representative data in future. I makes it easier and
saves time.
proc format;
value visit 1='Screening' 2='Day 1';
run;
data work.test;
input SUBID:$4. Test:$3. @;
do visit=1 to 2;
input COL DT:date9. @;
length AcrossVar $20;
AcrossVar = cats(vvalue(visit),'~',vvalue(dt));
output;
end;
format dt date9. visit visit.;
cards;
1020 EDC 3.4 08/MAY/06 3.4 08/JUN/06
1020 LDC 4.5 08/MAY/06 4.5 08/JUN/06
1020 MLC 4.6 08/MAY/06 4.6 08/JUN/06
1021 EDC 7.8 19/AUG/06 7.8 19/SEP/06
1021 LDC 8.7 19/AUG/06 8.7 19/SEP/06
1021 MLC 9.5 19/AUG/06 9.5 19/SEP/06
1022 EDC 8.8 11/SEP/06 8.8 11/OCT/06
1022 LDC 9.8 11/SEP/06 9.8 11/OCT/06
1022 MLC 9.9 11/SEP/06 9.9 11/OCT/06
;;;;
run;
proc print;
run;
option nocenter ls=64;
proc report nowd list split='~'; *showall;
by subid;
column test ('Sample' acrossVar, col);
define test / group width=4 'Test' '--';
define acrossVar / width=10 flow across order=data '--';
define col / max '--';
label subid='Subject';
run;
On 9/21/06, SUBSCRIBE SAS-L Chandra Gadde <ddraj2015@gmail.com> wrote:
> Hi Mark,
>
> Thank you very much for your answer. It did really help me. Is there
> anyway, I can do the same thing using PROC REPORT? Because I have asked to
> use PROC REPORT to solve this.
>
> Chandra,
>
>
>
>
> Hi Chandra,
>
> Here is one of many approaches:
>
>
>
> data sample;
> input SUBID COL1 DT1 $9.;
> cards;
> 1020 3.4 08/MAY/06
> 1020 4.5 08/MAY/06
> 1020 4.6 08/MAY/06
> 1021 7.8 19/AUG/06
> 1021 8.7 19/AUG/06
> 1021 9.5 19/AUG/06
> 1022 8.8 11/SEP/06
> 1022 9.8 11/SEP/06
> 1022 9.9 11/SEP/06
> ;
> run;
>
> proc format;
> value theTest
> 1 = 'EDC'
> 2 = 'LDC'
> 3 = 'MDC'
> ;
> run;
>
> data _null_;
> length stmp $200;
> dashline = repeat('-',73);
> retain sublineno 0;
>
> file 'c:\temp\MyOutput.txt';
> set sample end=done;
> by SUBID;
>
>
> * one-time header stuff ;
> if _N_ eq 1 then
> do;
> put @26 'Hematology Listing';
> put dashline;
> end;
>
> * iterative stuff ;
> if first.SUBID then
> do;
> sublineno = 0;
> put 'Subject: ' SUBID;
> put dashline;
> put 'Test' @23 'Screening';
> put @23 DT1;
> put dashline;
> end;
> sublineno + 1;
> put sublineno theTest. @23 COL1;
> if last.SUBID then put dashline;
>
> * one-time footer stuff ;
> if done then
> do;
> end;
>
> run;
>
>
>
>
>
>
> Hope this is helpful.
>
>
> Mark Terjeson
> Senior Programmer Analyst, IM&R
> Russell Investment Group
>
>
> Russell
> Global Leaders in Multi-Manager Investing
>
>
>
>
>
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> SUBSCRIBE SAS-L Chandra Gadde
> Sent: Thursday, September 21, 2006 6:07 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Column values in Labels
>
> Hi All,
>
> I have a data set that looks like this. (I have lot of other variables
> as well in addition to these columns).
>
> SUBID COL1 DT1
> 1020 3.4 08/MAY/06
> 1020 4.5 08/MAY/06
> 1020 4.6 08/MAY/06
> 1021 7.8 19/AUG/06
> 1021 8.7 19/AUG/06
> 1021 9.5 19/AUG/06
> 1022 8.8 11/SEP/06
> 1022 9.8 11/SEP/06
> 1022 9.9 11/SEP/06
>
> Each SUBID had one value for DT1. I need the output in this fashion.
>
> Hematology Listing
> ------------------------------------------------------------------------
> -
> Subject: 1020
> ------------------------------------------------------------------------
> -
> Test Screening
> 08/MAY/06
> ------------------------------------------------------------------------
> -
> EDC 3.4
> LDC 4.5
> MLC 4.6
> ------------------------------------------------------------------------
> --
> Subject: 1021
> ------------------------------------------------------------------------
> --
> Test Screening
> 19/AUG/06
> ------------------------------------------------------------------------
> --
> EDC 7.8
> LDC 8.7
> MLC 9.5
> ------------------------------------------------------------------------
> --
> Test Screening
> 11/SEP/06
> ------------------------------------------------------------------------
> --
> EDC 8.8
> LDC 9.8
> MLC 9.9
> ------------------------------------------------------------------------
> --
>
> I have done most part of this. But I don't know how to get the Lable
> name
> ----------
> Screening
> DT1
> ---------
> Please help me...
>
|