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 (March 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sun, 16 Mar 2008 09:33:59 -0500
Reply-To:   "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Subject:   Re: Appending to multiple files
Comments:   To: "S. K. Agarwal" <sobhesh@GMAIL.COM>
Content-Type:   text/plain; charset="iso-8859-15"

"S. K. Agarwal" wrote: > I have stock market trade data in different files with each files > giving a list of transactions on a particular date (e.g. file names > for transaction in 2005 Jan are 20050101, 20050102, ... 20050131).. > Each file contains 4 variables (stockcode time quantity price).. My > objective is to extract the data of all trades of 100 companies to > separate files company-wise. For example, all trades where stock = > 'Rel' in the month of Jan 2005 should be stored in a file called > 'Rel200501'.. > > One way to do this is to write 'proc append' (where stock = '') > command .. but this is very time consuming because it opens each date > file 100 times when I am working with 100 companies. Each of my > transaction file is around 200 MB which makes the process very time > consuming. > > > What I am thinking is rather than opening each transaction file 100 > times, is there a procedure to open each transaction file once and > append the information relating to particular stock in each stock > files. e.g. Calling file 20050101 once and storing data for REL to > REL200501, ICICI to ICICI200501.. (and so on for 100 companies) > > then calling file 20050102 and appending data for REL to REL200501, > ICICI to ICICI200501. > > This I think will save a lot of the processing time.

In a single data step, you can use a hash to split the incoming data into subtables named by company. The subtables can be appended using call EXECUTE after all the data has been split.

Some priors posts discuss splitting data with hash object. http://groups.google.com/group/comp.soft-sys.sas/search?group=comp.soft-sys.sas&q=Hash+of+hashes+and+dynamic+output&qt_g=1 or http://groups.google.com/group/comp.soft-sys.sas/search?group=comp.soft-sys.sas&q=Hash+based+data+splitter+for+limited+resources&qt_g=1

-- Richard A. DeVenezia http://www.devenezia.com/


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