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 (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 17:10:52 +0530
Reply-To:   Anindya Mozumdar <anindya.lugbang@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Anindya Mozumdar <anindya.lugbang@GMAIL.COM>
Subject:   Re: Splitting a large dataset
Comments:   To: jesper@hvidkildehusene.dk
In-Reply-To:   <1d29cdb6-aeeb-4efb-9414-ce6ca9eb9387@a29g2000pra.googlegroups.com>
Content-Type:   text/plain; charset=ISO-8859-1

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()


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