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 (August 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 25 Aug 2007 10:29:54 -0400
Reply-To:     Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:      Re: New to SAS question
Comments: To: rhjordan@VCU.EDU

Shelley,

If you are trying to do this to improve how you can later analyze your data, DON'T! You can do a lot more with the data, a lot more easily, in its current form.

However, if you are just trying to review your data, and not use the transformed file for later analysis, then you can get what you want with something like:

data have; input student $6. @10 college $10. @23 startdate $6. @32 enddate $6.; cards; V11111 VaTech 9/2005 5/2006 V11111 VaTech 9/2005 5/2006 V11111 Notre Dame 8/2004 5/2005 V11111 UNC 8/2002 5/2004 V22222 Harvard 9/2005 5/2006 V22222 Yale 8/2004 5/2005 V22222 Notre Dame 8/2002 5/2004 V33333 UW-Madison 9/2005 5/2006 V33333 Amherst 8/2004 5/2005 V33333 UCLA 8/2002 5/2004 ;

proc sql; create table temp as select student, college ||' ' ||startdate ||' ' ||enddate as thedata from have order by student; quit;

proc transpose data=temp out=want (drop=_:); var thedata; by student; run;

HTH, Art ----------- On Fri, 24 Aug 2007 19:09:00 -0700, Shelley <rhjordan@VCU.EDU> wrote:

>I have a data set that I am trying to query. It is basically a data >set of college applications. I want to query the following data: > >student id, college attended, attended date from, attended date to > >When I run this query, if a student attended more than one college, >the query creates a row for each college and dates attended. > >So, the output looks like this: > >V11111 VaTech 9/2005 5/2006 >V11111 Notre Dame 8/2004 5/2005 >V11111 UNC 8/2002 5/2004 > >Is there anyway to run the query and have only one row per student id >that lists each college and respective dates? > >I would like to see output like this: >V11111 VaTech 9/2005 5/2006 Notre Dame 8/2004 5/2005 >UNC 8/2002 5/2004 > > >Sorry for the simplicity of my question. > >Thanks from a newbie!


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