week_var = INTCK('WEEK','01/11/2009','07/11/2009');
proc print data = week;
It gives me an error in log-
NOTE: Character values have been converted to numeric values at the places given by: (Line)Column).
NOTE: Invalid numeric data, '01/11/2009' , at line 115 column 27.
NOTE: Invalid numeric data, '07/11/2009' , at line 115 column 40.
TransactionID=RX000152 DateofSale=03/11/2009 TimeofSale=11:27:53 LaptopModel=AP3965 UnitsSold=5
I have monthly data starts from 01/11/2009 and continue till 29/11/2009. I need to get summary data for each week and so have used the week().Kindly suggest the correction in code.
You are attempting to use SAS CHARACTER type variables where the documented expectation is that you are supplying a SAS numeric (date or datetime) variable.
I'm not going to continue to post DOC links and suggestions that go unheeded.
Honestly, to the OP MarkC, you really need to digest and learn from your posts when received and not simply move on to another request from your boss or whatever. It will help drastically with your future SAS programming productivity and effectiveness, if that's your intention and quest.
So, regarding this post: I suggest strongly that you read up on SAS DATE, TIME and DATETIME variables, and also (for this exercise) you will want to pay attention to how to code a SAS DATE literal as an argument to INTCK (and INTNX for that matter).
hi ... INTCK requires numeric variables as arguments
if you are specifying the dates as literals, express your dates a bit differently and use a date constant ...
week_var = INTCK('WEEK', '11jan2009'd , '11jul2009'd);
put "WEEK_VAR: " week_var;
if there's a date already in the data ...
input dt : mmddyy. @@;
week_var = INTCK('WEEK', '11jan2009'd , dt);
format dt mmddyy10.;
02/10/2009 03/07/2009 12/15/2009