From: siyuan li on 14 Dec 2009 23:26 hi,all, now I have a dataset like that: date trade 1991-02-10 15 1991-02-16 25 1991-06-25 36 1992-02-25 23 1992-06-12 54 the problem is I want to find out the trade every month of every year. can help me? thanks
From: Tom Abernathy on 15 Dec 2009 00:56 You subject line mentioned last obs. Did you mean the LAST trade of the month? If so then you could just create explicite YEAR and MONTH variables and use by processing. For example: data trades; input date yymmdd10. trade ; year = year(date); month = month(date); cards; 1991-02-10 15 1991-02-16 25 1991-06-25 36 1992-02-25 23 1992-06-12 54 run; data last; do until(last.month); set trades; by year month; end; output; run; On Dec 14, 11:26 pm, siyuan li <lisiyuan0...(a)gmail.com> wrote: > hi,all, now I have a dataset like that: > date trade > 1991-02-10 15 > 1991-02-16 25 > 1991-06-25 36 > 1992-02-25 23 > 1992-06-12 54 > the problem is I want to find out the trade every month of every year. > can help me? > thanks
From: Patrick on 15 Dec 2009 02:09 I assume you also want to summarise the trades per month. Try this: data have; input date:yymmdd10. trade; datalines; 1991-02-10 15 1991-02-16 25 1991-06-25 36 1992-02-25 23 1992-06-12 54 ; run; proc sql; select year(date) as year, month(date) as month, sum(trade) as trade from have group by year,month ; quit; HTH Patrick
From: siyuan li on 15 Dec 2009 05:16 On 12ÔÂ15ÈÕ, ÏÂÎç3ʱ09·Ö, Patrick <patrick.mat...(a)gmx.ch> wrote: > I assume you also want to summarise the trades per month. > Try this: > > data have; > input date:yymmdd10. trade; > datalines; > 1991-02-10 15 > 1991-02-16 25 > 1991-06-25 36 > 1992-02-25 23 > 1992-06-12 54 > ; > run; > proc sql; > select year(date) as year, month(date) as month, sum(trade) as trade > from have > group by year,month > ; > quit; > > HTH > Patrick thanks very much
From: siyuan li on 15 Dec 2009 05:25 On 12ÔÂ15ÈÕ, ÏÂÎç12ʱ26·Ö, siyuan li <lisiyuan0...(a)gmail.com> wrote: > hi,all, now I have a dataset like that: > date trade > 1991-02-10 15 > 1991-02-16 25 > 1991-06-25 36 > 1992-02-25 23 > 1992-06-12 54 > the problem is I want to find out the trade every month of every year. > can help me? > thanks Firstly I must say sorry. I want to find out the trade that the last day of every month of every year.
|
Next
|
Last
Pages: 1 2 Prev: help w do loop Next: Creating Dummy Variables from Values of Variables |