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 (May 2011, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 4 May 2011 12:18:05 -0500
Reply-To:   Joe Matise <snoopy369@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Joe Matise <snoopy369@GMAIL.COM>
Subject:   Re: column recoding
Comments:   To: oslo <hokut1@yahoo.com>
In-Reply-To:   <633563.27016.qm@web37508.mail.mud.yahoo.com>
Content-Type:   text/plain; charset=ISO-8859-1

Your main problem is it sounds like col_1-3 is not the right name for your format...

-Joe

On Wed, May 4, 2011 at 12:14 PM, oslo <hokut1@yahoo.com> wrote:

> Dear Joe; > > > > Here is the log file. There are a couple error messages. Any idea? > > > > Regads, > > > > Oslo > > > > > > 7421 data ped; > > 7422 input animal_id $ sire_id $ dam_id $; > > 7423 cards; > > NOTE: The data set WORK.PED has 7386 observations and 3 variables. > > NOTE: DATA statement used (Total process time): > > real time 0.04 seconds > > cpu time 0.04 seconds > > > > 14810 ; > > 14811 data for_format; > > 14812 set ped; > > 14813 start=col_1; > > 14814 output; > > 14815 start=col_2; > > 14816 output; > > 14817 start=col_3; > > 14818 output; > > 14819 keep start; > > 14820 run; > > NOTE: Variable col_1 is uninitialized. > > NOTE: Variable col_2 is uninitialized. > > NOTE: Variable col_3 is uninitialized. > > NOTE: There were 7386 observations read from the data set WORK.PED. > > NOTE: The data set WORK.FOR_FORMAT has 22158 observations and 1 variables. > > NOTE: DATA statement used (Total process time): > > real time 0.01 seconds > > cpu time 0.01 seconds > > > > 14821 > > 14822 proc sort nodupkey data=for_format; > > 14823 by start; > > 14824 run; > > NOTE: There were 22158 observations read from the data set WORK.FOR_FORMAT. > > NOTE: 22157 observations with duplicate key values were deleted. > > NOTE: The data set WORK.FOR_FORMAT has 1 observations and 1 variables. > > NOTE: PROCEDURE SORT used (Total process time): > > real time 0.03 seconds > > cpu time 0.03 seconds > > > > 14825 > > 14826 data for_format_fnl; > > 14827 set for_format; > > 14828 label=put(_n_,$6.); *replace 6 with a smaller number appropriate to > your data; > > WARNING: Variable _N_ has already been defined as numeric. > > 14829 fmtname='$RECODEF'; > > 14830 run; > > NOTE: There were 1 observations read from the data set WORK.FOR_FORMAT. > > NOTE: The data set WORK.FOR_FORMAT_FNL has 1 observations and 3 variables. > > NOTE: DATA statement used (Total process time): > > real time 0.00 seconds > > cpu time 0.00 seconds > > > > 14831 > > 14832 proc format cntlin=for_format_fnl lib=work; > > NOTE: Format $RECODEF is already on the library. > > NOTE: Format $RECODEF has been output. > > 14833 quit; > > NOTE: There were 1 observations read from the data set WORK.FOR_FORMAT_FNL. > > NOTE: PROCEDURE FORMAT used (Total process time): > > real time 0.01 seconds > > cpu time 0.01 seconds > > > > 14834 > > 14835 data want; > > 14836 set ped; > > 14837 newcol_1 = put(col_1,$RECODEF.); > > --------- > > 48 > > WARNING: Variable col_1 has already been defined as numeric. > > 14838 newcol_2 = put(col_2,$RECODEF.); > > --------- > > 48 > > WARNING: Variable col_2 has already been defined as numeric. > > 14839 newcol_3 = put(col_3,$RECODEF.); > > --------- > > 48 > > WARNING: Variable col_3 has already been defined as numeric. > > ERROR 48-59: The format RECODEF was not found or could not be loaded. > > 14840 run; > > NOTE: The SAS System stopped processing this step because of errors. > > WARNING: The data set WORK.WANT may be incomplete. When this step was > stopped there were 0 > > observations and 9 variables. > > NOTE: DATA statement used (Total process time): > > real time 0.01 seconds > > cpu time 0.01 seconds > > > ------------------------------ > *From:* Joe Matise <snoopy369@gmail.com> > *To:* oslo <hokut1@yahoo.com> > > *Cc:* SAS-L@listserv.uga.edu > *Sent:* Wed, May 4, 2011 11:59:03 AM > *Subject:* Re: column recoding > > Right, I was explaining a way to do that... something along these lines. > > data for_format; > set have; > start=col_1; > output; > start=col_2; > output; > start=col_3; > output; > keep start; > run; > > proc sort nodupkey data=for_format; > by start; > run; > > data for_format_fnl; > set for_format; > label=put(_n_,$6.); *replace 6 with a smaller number appropriate to your > data; > fmtname='$RECODEF'; > run; > > proc format cntlin=for_format_fnl lib=work; > quit; > > data want; > set have; > newcol_1 = put(col_1,$RECODEF.); > newcol_2 = put(col_2,$RECODEF.); > newcol_3 = put(col_3,$RECODEF.); > run; > > Does that do about what you want? > > -Joe > > On Wed, May 4, 2011 at 11:53 AM, oslo <hokut1@yahoo.com> wrote: > >> Joe; >> >> Thanks for writing. NO. I want creat 3 new columns with recoded or simply >> recode three existing columns. >> >> Oslo >> >> ------------------------------ >> *From:* Joe Matise <snoopy369@GMAIL.COM> >> >> *To:* SAS-L@LISTSERV.UGA.EDU >> *Sent:* Wed, May 4, 2011 11:43:29 AM >> *Subject:* Re: column recoding >> >> So essentially you could simply take all three columns, output them in a >> single column, use one of the various methods available to get unique >> values >> (proc freq, sort nodupkey, etc.), and then process that in a data step >> assigning _n_ as the value for each original value; then use a proc format >> to apply those values. >> >> No? >> >> -Joe >> >> On Wed, May 4, 2011 at 11:40 AM, oslo <hokut1@yahoo.com> wrote: >> >> > Nat; >> > >> > Thanks for writing. No there is no rule. I just gave an examle. Only >> rule >> > is >> > that there are same value in all 3 columns and they are repeating many >> > time. >> > These should be assigned with same value. >> > >> > regards, >> > >> > Oslo >> > >> > >> > >> > >> > ________________________________ >> > From: Nat Wooding <nathani@VERIZON.NET> >> > To: SAS-L@LISTSERV.UGA.EDU >> > Sent: Wed, May 4, 2011 11:31:55 AM >> > Subject: Re: column recoding >> > >> > Oslo >> > >> > Is there some set of rules that determine why IG should be 5 and 14 >> should >> > be 6? >> > >> > Nat Wooding >> > >> > -----Original Message----- >> > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of >> oslo >> > Sent: Wednesday, May 04, 2011 11:55 AM >> > To: SAS-L@LISTSERV.UGA.EDU >> > Subject: column recoding >> > >> > Dear all; >> > >> > I have very big and messy data set. I need to reorganize it via SAS for >> > analyses >> > the different software (ASREML....). I need to recode the first 3 >> columns >> > of >> > >> > data which they are for pedigree part. Each column contains both numeric >> > and >> > >> > non-numeric info. I want to convert all of them into numeric. Suppose >> the >> > first >> > columns of data is in the following pattern, >> > >> > Your helps are greatly appreciated. Regards, >> > >> > Oslo >> > >> > data I have data I want to have >> > id sire dam id sire dam >> > a4 ch a&M 1 2 3 >> > 9 IG 14 4 5 6 >> > R/h cm R/h 7 8 7 >> > . . . . . . >> > and so on >> > >> > >> > >


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