Help using Base SAS procedures

Working with the Dates and Time using SAS

Reply
N/A
Posts: 0

Working with the Dates and Time using SAS

data PrepForTabulate /view=PrepForTabulate;
set sales;
DateofSale=datepart(DateTimeofSale);
SameDayDelivery=timepart(DateTimeofSale)<='15:00:00't;
run;
proc print data = PrepForTabulate;
run;


When I run this code the DateTimeofSale column shows no result as do the Dateof Sale column . I think that i need to convert the date first but really stucked in doing it as I dont have any information on the width of the Date variable. The log says :-

403 data PrepForTabulate /view=PrepForTabulate;
404 set sales;
405 DateofSale=datepart(DateTimeofSale);
406 SameDayDelivery=timepart(DateTimeofSale)<='15:00:00't;
407 run;

NOTE: Numeric values have been converted to character values at the places given by: (Line)Smiley SadColumn).
405:14
NOTE: DATA STEP view saved on file WORK.PREPFORTABULATE.
NOTE: A stored DATA STEP view cannot run under a different operating system.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.03 seconds


408 proc print data = PrepForTabulate;
409 run;

NOTE: Variable DateTimeofSale is uninitialized.
NOTE: Writing HTML Body file: sashtml20.htm
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line)Smiley SadColumn).
425 at 472:14 425 at 473:19
NOTE: View WORK.PREPFORTABULATE.VIEW used (Total process time):
real time 0.18 seconds
cpu time 0.20 seconds

Kindly guide as to what addition i need to make to data step in oredr that the new variable DateTimeofSale and DateofSale gives result.

Regards ,

siddharth
SAS Super FREQ
Posts: 8,743
Ask a Question
Discussion stats
  • 1 reply
  • 234 views
  • 0 likes
  • 2 in conversation