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 (September 2007, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 19 Sep 2007 13:47:04 -0400
Reply-To:     Haigang Zhou <hzhou3@UNLSERVE.UNL.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Haigang Zhou <hzhou3@UNLSERVE.UNL.EDU>
Subject:      Re: Fixed length signals

Thank you all for the solutions. I really like the mod(_N_,3) commend.

Below is another solution from S. Xiao:

************************************************ data raw; input date date11. indicator; cards; 13-Dec-2004 1 14-Dec-2004 0 15-Dec-2004 1 16-Dec-2004 0 17-Dec-2004 0 20-Dec-2004 0 21-Dec-2004 1 22-Dec-2004 1 23-Dec-2004 0 24-Dec-2004 1 27-Dec-2004 0 28-Dec-2004 0 29-Dec-2004 0 30-Dec-2004 1 31-Dec-2004 0 4-Jan-2005 1 5-Jan-2005 1 6-Jan-2005 0 7-Jan-2005 0 10-Jan-2005 0 11-Jan-2005 1 12-Jan-2005 1 13-Jan-2005 0 14-Jan-2005 0 ; run; data tmp(drop=tmp); retain date indicator tmp; set raw; format date mmddyy8. signal $4.; if mod(_N_,3)=1 then if indicator=1 then tmp='buy'; else tmp='sell'; if mod(_N_,3)=1 then signal=''; else signal=tmp; run; ***********************************************************


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