my original file divided time periods this:
period p1 p2 p3 p4 p5 p6 p7 03/01/2013 06/01/2013 31.0 16.5 28.7 18.1 23.4 16 12.0 07/01/2013 09/01/2013 31.0 18.0 29.3 19.2 24.3 13 3.6
however, file has many rows , need files remain that:
period p1 p2 p3 p4 p5 p6 p7 03/01/2013 31.0 16.5 28.7 18.1 23.4 16 12.0 04/01/2013 31.0 16.5 28.7 18.1 23.4 16 12.0 05/01/2013 31.0 16.5 28.7 18.1 23.4 16 12.0 06/01/2013 31.0 16.5 28.7 18.1 23.4 16 12.0 07/01/2013 31.0 18.0 29.3 19.2 24.3 13 3.6 08/01/2013 31.0 18.0 29.3 19.2 24.3 13 3.6 09/01/2013 31.0 18.0 29.3 19.2 24.3 13 3.6
does know how in practical way using sas or linux?
just use loop. can use intck()
function know how many iterations , intnx()
function calculate new date values.
here sample data.
data have; length start stop p1-p7 8; informat start stop mmddyy.; format start stop yymmdd10.; input start stop p1-p7; cards; 03/01/2013 06/01/2013 31.0 16.5 28.7 18.1 23.4 16 12.0 07/01/2013 09/01/2013 31.0 18.0 29.3 19.2 24.3 13 3.6 ;;;;
now write new data step expand number of rows.
data want; format period yymmdd10.; set have ; offset=0 intck('month',start,stop); period = intnx('month',start,offset); output; end; run;
Comments
Post a Comment