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 (September 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 1 Sep 2006 19:23:08 +0000
Reply-To:     toby dunn <tobydunn@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         toby dunn <tobydunn@HOTMAIL.COM>
Subject:      Re: format from cntlin dataset
Comments: To: ya.huang@AMYLIN.COM
Comments: cc: diannerhodes@COMCAST.NET
In-Reply-To:  <>
Content-Type: text/plain; format=flowed

Ya and Dianne ,

The problem is two fold one there is no Other specified in teh format and two the format that was created did not do what it was designed to do since it wasnt specified with a length.

To truelly see the problem run Diannes code but change:

item_sid = input(put(item_code, $items.),best.) ;


item_sid = input(put(item_code, $items12.),best.) ;

And you should get an error. otherwise it just pulls the first character from the Item_code string and converts that into a numeric using the best. informat. All in all you need to both specify a other category in the format used and specify a length on the format when you use it.

Toby Dunn

When everything is coming at you all at once, your in the wrong lane.

A truly happy person is someone who can smile and enjoy the scenery on a detour.

From: Ya Huang <ya.huang@AMYLIN.COM> Reply-To: Ya Huang <ya.huang@AMYLIN.COM> To: SAS-L@LISTSERV.UGA.EDU Subject: Re: format from cntlin dataset Date: Fri, 1 Sep 2006 15:05:46 -0400

Looks like you have to define 'other' in the format:

DATA ITEM_REF ; SET item_code_sid_map; LENGTH start end $13 ; fmtname='ITEMS'; type='C'; start=mf_item_code; end=start; label=item_sid; output; start='Other'; end=start; label=' '; output; RUN;

Samething happens if you hard coding define the format without defining the other:

proc format; value $myiterms '1311--AD13I01'='1' other=' ' /* if this is commented out, you get the same result */ ;


On Fri, 1 Sep 2006 14:13:53 -0400, Dianne Rhodes <diannerhodes@COMCAST.NET> wrote:

>One of my colleagues is developing code to create a format for all of the >valid values on the mainframe, and assign it a numeric key, starting with >one. To eliminate noise, she wants to get rid of everything that doesn't >match her format. She wrote this code, but the results were not as >expected. We expected one good value and one bad value, but instead both >values passed the format. Take a look. I know its Friday and you were >looking for OT Friday humor, but I think its important to be aware of this >problem. > >Here's the code - you can run it yourself. Version 9.1.3 I've solved the >problem and when you all finish wrassling with it I'll explain. > >data item_code_sid_map; > length mf_item_code $13. > item_sid 8; > mf_item_code = '1311--AD13I01'; > item_sid = 1; >run; > >DATA ITEM_REF ; >SET item_code_sid_map; >LENGTH start end $13 ; >fmtname='ITEMS'; >type='C'; >start=mf_item_code; >end=start; >label=item_sid; >RUN; > >PROC format cntlin=ITEM_REF; >RUN; > >data item; > length item_code $13. > ; > item_code = '1311--AC13I99'; output; > item_code = '1311--AD13I01'; output; >run; > >data item_w_sid item_err; > set item; > item_sid = input(put(item_code, $items.),best.) ; > if missing(item_sid) then > output item_err; > else > output item_w_sid; >run; > >proc print data=item_w_sid; >run; > >and Here's the results... >27 >28 data item_w_sid item_err; >29 set item; >30 item_sid = input(put(item_code, $items.),best.) ; >31 if missing(item_sid) then >32 output item_err; >33 else >34 output item_w_sid; >35 run; > >NOTE: There were 2 observations read from the data set WORK.ITEM. >NOTE: The data set WORK.ITEM_W_SID has 2 observations and 2 variables. >NOTE: The data set WORK.ITEM_ERR has 0 observations and 2 variables. >NOTE: DATA statement used (Total process time): > real time 0.09 seconds > cpu time 0.00 seconds > > >Thanks! > >Dianne Rhodes @ bls

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