Convert string to date and select cases which fall during the weekend
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | * (Q) My dates are curently strings, I need dates and also need to select dates which fall on a Saturday or Sinday. *(A) Posted to SPSSX-L list by Raynald Levesque on 2002/02/28. DATA LIST LIST /str1(A10) id(F8.0). BEGIN DATA 2001-03-04 087900 1990-07-28 458900 2001-02-16 895241 2001-03-09 448801 1998-09-30 890210 1999-12-31 754890 END DATA. COMPUTE date1=NUMBER(str1,SDATE10). COMPUTE wkday1=XDATE.WKDAY(date1). COMPUTE flag=ANY(wkday1,1,7). VARIABLE WIDTH date1(11) wkday1(10). FORMATS wkday1(WKDAY9)date1 (ADATE11). EXECUTE. |
Related pages
...