Date: Fri, 3 Nov 2006 16:02:54 -0500
Reply-To: "data _null_;" <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_;" <datanull@GMAIL.COM>
Subject: Re: transpose
In-Reply-To: <445d9dbe0611031257x47dfda62q440b582e86d1211@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
UPCASE JUST
as in
invalue $vcode(UPCASE JUST)
to left justify and upcase the value to be read by the informat $VCODE.
add CNTLOUT=Control to the PROC FORMAT and then CONTENTS and PRINT and
study the output. It is very interesting.
Best regards,
_null_
On 11/3/06, Yu Zhang <zhangyu05@gmail.com> wrote:
> Hi, Data _null,
>
> I learned lots useful stuffs from your recently posts about creating fromat
> from datasets. Could you explain what does 'UJ' mean in HLO option? I
> searched the onlinedoc and these two are not specifyed.
>
> Thanks!
>
> Yu
>
> On 11/3/06, data _null_; <datanull@gmail.com> wrote:
> >
> > To follow up on Mr. Cassell's excellent advice, here is a little
> > example using an INFORMAT to read the values of site and "look-up" the
> > V code associated with it.
> >
> > In this example you can ignore the use of my second favorite procedure
> > PLAN and concentrate on creating the format that will code the SITES.
> > You will need to consult the documentation for PROC FORMAT.
> >
> >
> > proc plan seed=11235811; /* test data */
> > factors
> > usubjid = 5 ordered
> > site = 4 of 7 random
> > / noprint;
> > output
> > out=work.site
> > site cvals=('Breast' 'Chest Wall' 'Chest Wall/Axil Nodes'
> > 'Chest' 'Axilla' 'Lymph node' 'other')
> > ;
> > run;
> >
> > proc print;
> > run;
> > data work.Vcodes;
> > infile cards dsd missover;
> > retain fmtname 'VCODE' type 'J' hlo 'UJ';
> > input label:$32. start:$quote32. @;
> > do while(not missing(start));
> > start = upcase(start);
> > output;
> > input start:$quote32. @;
> > end;
> > cards;
> > V107,'Breast','Chest Wall','Chest Wall/Axil
> > Nodes','Chest','Axilla','Lymph node','other'
> > ;;;;
> > run;
> > proc print;
> > run;
> > proc format cntlin=work.vcodes;
> > run;
> > data work.site;
> > set work.site;
> > length vcode $4;
> > vcode = input(site,$vcode.);
> > run;
> > proc print;
> > run;
> >
> >
> >
> >
> > On 11/3/06, David L Cassell <davidlcassell@msn.com> wrote:
> > > jessica.donato@GMAIL.COM wrote:
> > > >
> > > >hello. I have an efficiency problem and may not be thinking about this
> > > >properly:
> > > >
> > > >I just transposed a data that now contains 4 variables; (site1 site2
> > > >site3 site4).
> > > >
> > > >In want to perform a logic statement like this:
> > > >
> > > >IF SITE in ('Breast','Chest Wall' ,'Chest Wall/Axil Nodes' , 'Chest' ,
> > > >'Axilla', 'Lymph node', 'other') THEN V107= 2;
> > > >ELSE V107= 1;
> > > >
> > > >Does anyone know a quick way to program the variable SITE= site1 site2
> > > >site3 site4. does this make sense? for instance i tried this below
> > > >but it doesnt seem right:
> > > >
> > > >IF SITE1 or site2 or site3 or site4 in ('Breast','Chest Wall' ,'Chest
> > > >Wall/Axil Nodes' , 'Chest' ,
> > > >'Axilla', 'Lymph node', 'other') THEN V107= 2;
> > > >ELSE V107= 1;
> > > >
> > > >in addition i tried to rename site1, etc. to the same name with an
> > > >array and this wasnt working for me. any suggestion would be
> > > >appreciated! thanks
> > >
> > > I'm glad you're thinking about efficiency. One of the efficiencies
> > > I care the most about is 'programmer efficiency' - writing code that
> > > works, and writing less code that works at least as well, and
> > > writing cleaner code that make *my* life easier. I'm all about
> > 'me'. :-)
> > >
> > > I would suggest that - in addition to the fine advice you have
> > > already received - you consider stepping back to the UN-transposed
> > > data. Then it may become a lot easier.
> > >
> > >
> > > if first.patientID then V107 = 1;
> > > if site in ('Breast','Chest Wall' ,'Chest Wall/Axil Nodes' , 'Chest' ,
> > > 'Axilla', 'Lymph node', 'other')
> > > then V107+1;
> > >
> > >
> > > You might also think about formats here. SAS formats make
> > > great look-up tables, and it seems like you have a bunch of
> > > look-up tables to implement in your code.
> > >
> > > HTH,
> > > David
> > > --
> > > David L. Cassell
> > > mathematical statistician
> > > Design Pathways
> > > 3115 NW Norwood Pl.
> > > Corvallis OR 97330
> > >
> > > _________________________________________________________________
> > > Try Search Survival Kits: Fix up your home and better handle your cash
> > with
> > > Live Search!
> > >
> > http://imagine-windowslive.com/search/kits/default.aspx?kit=improve&locale=en-US&source=hmtagline
> > >
> >
>
|