10-12-2014 07:50 PM
10-12-2014 11:23 PM
Couple of things
1. In SAS you refer to dates as '01Mar2009'd instead of 2009-03-01
2. <> is not a valid operator in SAS, it gets interpreted as max, when you probably mean NE, replace it with NE
3. Remove the as "Source" from the code. Notice the bracket after the calculation and the "as calculation" SAS is automatically naming it calculation.
I'm not sure how you're creating the case statement, it may be more helpful to show a screenshot of that.
Hope some of the above helpful.
10-13-2014 12:24 AM
Now my script is;
CASE WHEN t1.Date_Created < '01Mar2009'd THEN 'Infield Sales'
WHEN t1.SalesRepID IS NOT NULL THEN 'Infield sales'
WHEN t1.CreatedByUserID = 1 AND t1.Date_Created >= '01Mar2009d' THEN 'Online'
WHEN t1.CreatedByUserID NE 1 THEN 'CallCentre'
The only error I'm getting is the '<' comparison is on different data types.
I've converted the Original 'Date Time' format to 'DDMMYYN8' so it seems I now have an issue with the date Formats?
Thanks for your help so far Reeza, I think you've nearly got it !
10-13-2014 12:49 AM
If your original variable in the database is date time you'll need to convert it to a date variable first or wrap all the date_created variables in the datepart function to get just the date portion. Datepart(t1.date_created)
10-13-2014 01:00 AM
Thanks Reeza, I had done the DATEPART bit but then saw that I had written the second date with the apostrophe after the 'd' instead of in front of it.
Now it works fine. Thanks heaps : >