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 (December 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 22 Dec 2008 12:41:24 -0800
Reply-To:     jesper@HVIDKILDEHUSENE.DK
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         jesper@HVIDKILDEHUSENE.DK
Organization: http://groups.google.com
Subject:      Re: Splitting a large dataset
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

On 22 Dec., 12:40, anindya.lugb...@GMAIL.COM (Anindya Mozumdar) wrote: > A slightly more general solution to the one above - > > data test; > input name $ data $; > datalines; > Jens A > Jens G > Jens X > Ole D > Ole B > ; > run; > > proc sql noprint; > select distinct upcase(name) into :distnames separated by '|' > from test; > quit; > %let cntnames = %sysfunc(countc(&distnames, |)); > %let cntnames = %eval(&cntnames + 1); > %put &cntnames &distnames; > > %macro splitDs(); > > data %do i = 1 %to &cntnames; test_%scan(&distnames,&i, |) %end;; > set test; > %do i = 1 %to &cntnames; > %let currname = %scan(&distnames,&i, |); > if trim(upcase(name)) = "&currname" > then output test_%scan(&distnames,&i, |); > %end; > run; > > %mend splitDs; > > %splitDs()

Thank you very much for your answers - everyone. It is very appreciated.

I have used the macro-code above and it works perfectly when I use numbers instead of names. There is a number attached to each person (almost, some of the persons have two numbers and thats why I rather will use the names than the numbers). I will figure out how to do it with the names (use underscore instead of space) when I get back to work after christmas :-) No use for help.

Thanks


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