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 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 18 Dec 2006 10:52:52 -0500
Reply-To:     wing wah <wing.tham03@PHD.WBS.AC.UK>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         wing wah <wing.tham03@PHD.WBS.AC.UK>
Subject:      storing numbers of observations in splitted files

Hello folks,

I am doing some exercise on foreign exchange market. There are three currencies pair in my data. The data is huge and i am trying to split them into files by using date as an index. I also want to count the number of observations in each of these splitted files and stored them for future use.

I am rather poor in sas and this what i have written. There must be an easy way to count and save the number of observations according to the currency pair and the corresponding date. Can someone advise me on how i can save the number of observations indexed by the currency pairs and dates? Thank you in advance.

%let C=eur_gbp@eur_usd@gbp_usd; /*three currency pairs*/

/*macro to count the number of observations and stored them*/ %macro nobs(data,name); %global &name; data _null_; if 0 then set &data nobs=count; call symput ("&name",left(put(count,8.))); stop; run; %mend nobs;

/*macro to split a big file into smaller files indexed according to their dates for the three currency pairs*/

%macro day; %do ic=1 %to 3;

proc sort data = lob.%scan(&C,&ic,@)_new_bid ( keep = date ) out = w nodupkey ; by date ; run ;

data _null_ ;

call execute ( "data " ) ; do until ( eof ) ; set w end = eof nobs=count; call execute ( "lob.%scan(&C,&ic,@)_bid_" || put ( date, 5. ) ) ; end ; call execute ( "; set lob.%scan(&C,&ic,@)_new_bid ; select ( date ) ;" ) ;

eof = 0 ; do until ( eof ) ; set w end = eof nobs=count; call execute ( "when (" || put (date, 5.) || ") output " || "lob.%scan (&C,&ic,@)_bid_" || put (date, 5.) || ";" ) ; end ; call execute ( "otherwise error ; end ; run ; " ) ;

stop ; run ;

%end; %mend; %day;


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