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 (January 2002, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 24 Jan 2002 16:01:27 -0500
Reply-To:   Casey Pierce <casey@SDAC.HARVARD.EDU>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
Comments:   To: Ian Whitlock <WHITLOI1@WESTAT.com>
From:   Casey Pierce <casey@SDAC.HARVARD.EDU>
Subject:   Re: format oddity
Comments:   To: SAS-L@LISTSERV.VT.EDU
In-Reply-To:   <08B08C9FA5EBD311A2CC009027D5BF8102E2ACE0@remailnt2-re01.westat.com>
Content-Type:   TEXT/PLAIN; charset=US-ASCII

Ian,

Thanks - I was hoping there would be a shorter route to take than your solution, but alas... Thanks alot for your help.

-Casey

On Thu, 24 Jan 2002, Ian Whitlock wrote:

> Subject: RE: format oddity > Summary: How to update formats > Respondent: IanWhitlock@westat.com > > Casey, > > Your code > > > proc format; > > value drgcde > > 8180007="Some Drug" > > other =[drgcde.]; > > run; > > appears circular. When I ran the code as is it seemed to execute, but then > I got an error message saying that it ran out of stack space on the next > step. When I changed the name in the brackets it ran fine. > > Remember you are not really updating DRGCDE. The format above merely stores > the format reference which happens to be to itself so the format will not be > usable. Now it is circular. > > I do not know why you saw the affect you did, but I am convinced it it had > something to do with the your circular reference to the same format when the > format was applied. > > To really update DRGCDE you might use > > proc format ; > value drgcde > 1 = "123456789012345" > other = "Other" ; > run ; > > proc format cntlout = fmtdata ; > select drgcde ; > run ; > > proc sort data = fmtdata ; > by fmtname start end ; > run ; > > data trans ; > length start end $ 16 fmtname $ 8 label $ 40 ; > start = "8180007" ; > end = "8180007" ; > label = "Some Drug" ; > fmtname = "drgcde" ; > output ; > run ; > > data fmtdata ; > length start end $ 16 fmtname $ 8 label $ 40 ; > update fmtdata trans ; > by fmtname start end ; > run ; > > proc format cntlin = fmtdata fmtlib ; > run ; > > Using the UPDATE statement worked with both numeric and character formats. > When I tried to avoid it I fell into all sorts of little traps. > > The LENGTH statement given might cause trouble with a format where either > the START/END or LABEL lengths are too short. > > IanWhitlock@westat.com > > -----Original Message----- > From: Casey Pierce [mailto:casey@SDAC.HARVARD.EDU] > Sent: Thursday, January 24, 2002 1:52 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: format oddity > > > When I update a permanent format, I lose my macro variables. > I don't update formats often, so I'm at a bit of a loss. > The gist of the program is the follows: > > ********************************************************** > %let FORM = txw0000; > > proc format; > value drgcde > 8180007="Some Drug" > other =[drgcde.]; > run; > > %include "&FORM..dat"; > > data &FORM; > set outfile; > > format drug drgcde.; > > label week = "&FORM week"; > > run; > > > proc sort data=&FORM; > by patid; > run; > > ************************************************************* > > FORM resolves just fine in the data statement, but once > it gets to the labels, I get the warning that symbolic > reference not resolved. If I don't apply the format, or > if I change the name of the format that I'm creating, > there's no problem. Is there any way to update a format > this way (with the same name) and can someone explain how > this is causing the loss of the macro variables? Thanks so much. > > -Casey >


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