LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (February 2010, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 2 Feb 2010 13:28:35 -0600
Reply-To:     Joe Matise <snoopy369@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Joe Matise <snoopy369@GMAIL.COM>
Subject:      Re: data cleaning
Comments: To: ChrisG <chris.godlewski@gmail.com>
In-Reply-To:  <28f6e7e8-a3cb-4362-b06e-2b1f7ef38335@f11g2000yqm.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1

If you have it as raw data (in a text file), you can do this on input with RETAIN. Just read in the id variable, which is RETAINed, and then ask SAS to not output those rows that do have the id variable in the raw data [or, ask it not to output rows that don't have some important variable].

If you have it in SAS (or some other non-text data), you can use RETAIN in a new datastep:

data want; set have; retain id_new; if not missing(id) then id_new=id; else output; run;

That's pretty simplistic and doesn't check for error conditions, so you'd want to beef it up for production-quality code, but that should do the change you were asking for.

-Joe

On Tue, Feb 2, 2010 at 10:14 AM, ChrisG <chris.godlewski@gmail.com> wrote:

> Hi > > I have this kind of data : > > 1 LN469113 Corp . . . . . > 3 11/25/2005 6 4 171906 0 0 > 4 11/25/2005 6 15 171906 0 0 > 5 11/25/2005 6 150 171906 0 0 > 6 11/25/2005 6 220 171906 0 0 > 7 11/25/2005 6 251 364908 0 0 > 8 11/25/2005 6 251 909795 0 0 > 1 LN469121 Corp . . . . . > 3 11/25/2005 6 4 171906 0 0 > 4 11/25/2005 6 15 171906 0 0 > 5 11/25/2005 6 150 171906 0 0 > 6 11/25/2005 6 220 171906 0 0 > 7 11/25/2005 6 251 364908 0 0 > 8 11/25/2005 6 251 909795 0 0 > 1 LN469125 Corp . . . . . > 3 11/25/2005 6 4 171906 0 0 > 4 11/25/2005 6 15 171906 0 0 > 5 11/25/2005 6 150 171906 0 0 > 6 11/25/2005 6 220 171906 0 0 > 7 11/25/2005 6 251 364908 0 0 > 8 11/25/2005 6 251 909795 0 0 > > And i need it that way (i added the name of variables for > convenience) : > > id date type role id2 > league percentage > LN469113 Corp 11/25/2005 6 4 171906 0 0 > LN469113 Corp 11/25/2005 6 15 171906 0 0 > LN469113 Corp 11/25/2005 6 150 171906 0 0 > LN469113 Corp 11/25/2005 6 220 171906 0 0 > LN469113 Corp 11/25/2005 6 251 364908 0 0 > LN469113 Corp 11/25/2005 6 251 909795 0 0 > LN469121 Corp 11/25/2005 6 4 171906 0 0 > LN469121 Corp 11/25/2005 6 15 171906 0 0 > LN469121 Corp 11/25/2005 6 150 171906 0 0 > LN469121 Corp 11/25/2005 6 220 171906 0 0 > LN469121 Corp 11/25/2005 6 251 364908 0 0 > LN469121 Corp 11/25/2005 6 251 909795 0 0 > LN469125 Corp 11/25/2005 6 4 171906 0 0 > LN469125 Corp 11/25/2005 6 15 171906 0 0 > LN469125 Corp 11/25/2005 6 150 171906 0 0 > LN469125 Corp 11/25/2005 6 220 171906 0 0 > LN469125 Corp 11/25/2005 6 251 364908 0 0 > LN469125 Corp 11/25/2005 6 251 909795 0 0 > > I definitely can't make SAS copy paste the content of a cell in > another colmun and duplicate it ... > And i am not a proc iml - user at all by the way > > Hopefully someone around here had a similar problem... > > Thanks in advance > Cheers > CG >


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