Jen9814,
What determines the sale date. Do you consider the sent date or the purchase date as the basis for the sale count.
Either way why not count the records that have one of your dates filled in. (I presume that the 'sale' information you are looking for is determined by haveing one of those fields filled in.) You will have to assign the records to a week value. You can accomplish this by using the intchk function.
data test;
set your_ds;
week_var = INTCK('WEEK',begin_date,sale_date);
run;
You can use proc sql like this;
proc sql;
create table temp as
select week_var, count(sale_date) as number_of_sales
from test
group by week_var;
quit;
This should give you the number of sales in a given week. Note that the SAS WEEK function uses the number of Sundays in the time frame as the week number.
How about this little beauty. I tried to do something similar a little while back and created my own format to produce a year/week result from a SAS date.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.