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 (April 2006, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 10 Apr 2006 14:03:36 -0400
Reply-To:     Jonas Bilenas <jonas.bilenas@CHASE.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jonas Bilenas <jonas.bilenas@CHASE.COM>
Subject:      Re: Two level format name, possible?

Try this, from my book; The Power of PROC FORMAT.

Few errors in my last post. Try this:

options nocenter symbolgen mprint fullstimer; proc format; value study 1='visita' 2='visitb' ; value visita 1='Day -7' 2='Week 1' 3='Week 4' ;

value visitb 1='Day -7' 2='Week 1' 3='Week 6' ;

data visit; study=1; visit=1; output; study=1; visit=2; output; study=1; visit=3; output; study=2; visit=1; output; study=2; visit=2; output; study=2; visit=3; output; run;

** this does work; data visit; set visit; fmtuse=put(study,study.); cvisit=putn(visit,fmtuse); run; proc print data=visit; run;

OUTPUT:

Obs study visit fmtuse cvisit

1 1 1 visita Day -7 2 1 2 visita Week 1 3 1 3 visita Week 4 4 2 1 visitb Day -7 5 2 2 visitb Week 1 6 2 3 visitb Week 6

Jonas Bilenas

On Mon, 10 Apr 2006 12:09:54 -0400, Ya Huang <ya.huang@AMYLIN.COM> wrote:

>Hi there, > >Assuming that I have two formats catalog stored in two different place, >and the format names are same. Is there any way I can use them in one >data step with some kind two level name reference? I search the SAS-L >archive, and found one very old thread (10 year ago) which basically >concluded that no easy way to do this. I wonder if this has been changed >with all the later version of SAS: > >proc format library=v1; >value visit >1='Day -7' >2='Week 1' >3='Week 4' >; > >proc format library=v2; >value visit >1='Day -7' >2='Week 1' >3='Week 6' >; > >data visit; >study=1; visit=1; output; >study=1; visit=2; output; >study=1; visit=3; output; >study=2; visit=1; output; >study=2; visit=2; output; >study=2; visit=3; output; >run; > >** this doesn't work; >data visit; > set visit; >if study=1 then cvisit=put(visit,v1.visit.); >else if study=2 then cvisit=put(visit,v2.visit.); >run; > > >Thanks > >Ya


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