Pathi Codes

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Pathi Codes as PDF for free.

More details

  • Words: 207
  • Pages: 3
data date_t; input data_time $1-22; datalines; 2007-04-27-12.58.28.000000 2007-04-27-12.58.28.000000 2007-04-27-12.58.28.000000 2007-04-27-15.02.46.000000 2007-04-27-20.47.41.000000 2007-04-27-20.10.40.000000 2007-04-28-12.33.08.000000 2007-04-28-13.55.32.000000 2007-04-28-13.55.32.000000 2007-04-28-15.30.59.000000 2007-04-27-11.50.18.000000 2007-04-27-11.50.18.000000 2007-04-27-20.10.40.000000 2007-04-27-14.34.21.000000 2007-04-28-18.30.05.000000 2007-04-28-18.30.05.000000 2007-04-27-20.47.41.000000 2007-04-28-15.49.28.000000 2007-04-28-15.49.28.000000 2007-04-28-15.30.59.000000 2007-04-27-15.13.54.000000 2007-04-27-15.13.54.000000 2007-04-27-14.43.04.000000 2007-04-27-14.43.04.000000 2007-04-27-14.43.04.000000 2007-04-28-14.43.20.000000 2007-04-27-13.20.51.000000 2007-04-27-13.20.51.000000 2007-04-27-13.20.51.000000 2007-04-28-13.51.52.000000 2007-04-28-12.45.42.000000 2007-04-28-12.45.42.000000 2007-04-27-16.02.50.000000 ;

data date_t; set date_t; start_date=substr(data_time,1,10); start_time=substr(data_time,12,22); run; Note: starts reading from column 1 and stop reading at 10th column,IIIly start at 12 to end at 22. data date_t; set date_t; start_date1= input( start_date, yymmdd10.); format start_date1 yymmdd10.; start_time1=input( start_time,time11.2); run;

Note: Converting character to number using informat and writing to date form using inform.

data date_t; set date_t; start_date1= input( start_date, yymmdd10.); format start_date1 yymmdd10.; start_time1=input( start_time,time11.2); if 28800=<start_time1<=72000 then shift='Day'; else shift='Night'; run; Note: 1)28800=8*60*60 and 72000=20*60*60 means converting hrs into sec…. Because SAS stores time in seconds. Created shift variable b looking into time. 2)Datasets name and variable names need not to be the same Means you can chage accor.. to U.

/*note:i hope sat and sunday are weekend days*/ /*code for:if you want 1.working day and weekend 2.Day and night as saparate variables*/ data date_t; set date_t; start_date1= input( start_date, yymmdd10.); format start_date1 weekdate30.; start_time1=input( start_time,time11.2); if 28800=<start_time1<=72000 then day_shift='Day'; else night_shift='Night'; day=scan(start_date1,1,','); if day=17284 or day=17285 then working_day='Working day'; else weekend_day='Weekend day'; run;

Related Documents

Pathi Codes
November 2019 4
Pathi-pathni
June 2020 3
Codes
October 2019 37
Codes
October 2019 43
Codes
November 2019 43