11-10-2017
tparvaiz
Obsidian | Level 7
Member since
06-22-2012
- 134 Posts
- 18 Likes Given
- 0 Solutions
- 1 Likes Received
-
Latest posts by tparvaiz
Subject Views Posted 1388 11-10-2017 05:07 PM 1401 11-10-2017 12:45 PM 1453 11-10-2017 01:40 AM 968 09-20-2017 02:14 PM 1010 09-18-2017 04:36 PM 1620 07-25-2017 09:24 PM 1488 07-18-2017 02:29 PM 1489 07-18-2017 02:26 PM 3827 06-22-2017 04:34 PM 3846 06-22-2017 03:53 PM -
Activity Feed for tparvaiz
- Posted Re: sas eg 7.15 - compatibility question on SAS Programming. 11-10-2017 05:07 PM
- Posted Re: sas eg 7.15 - compatibility question on SAS Programming. 11-10-2017 12:45 PM
- Posted sas eg 7.15 - compatibility question on SAS Programming. 11-10-2017 01:40 AM
- Posted Re: how to find time interval between the datetime on the row and the previous row on SAS Programming. 09-20-2017 02:14 PM
- Posted how to find time interval between the datetime on the row and the previous row on SAS Programming. 09-18-2017 04:36 PM
- Posted how to send email to recipients that are stored in a table on SAS Programming. 07-25-2017 09:24 PM
- Posted Re: how to send emails to recipients extracted from the dataset on SAS Programming. 07-18-2017 02:29 PM
- Posted Re: how to send emails to recipients extracted from the dataset on SAS Programming. 07-18-2017 02:26 PM
- Posted Re: SAS vs SQL Server Mgmt Studio - Sas takes longer to pull data on SAS Programming. 06-22-2017 04:34 PM
- Posted SAS vs SQL Server Mgmt Studio - Sas takes longer to pull data on SAS Programming. 06-22-2017 03:53 PM
- Liked Re: how to transpose selected data lines from row to column for Jagadishkatam. 06-22-2017 03:41 PM
- Posted how to transpose selected data lines from row to column on SAS Programming. 06-14-2017 08:35 PM
- Posted Re: extract month and a year from date time field on SAS Programming. 06-09-2017 05:06 PM
- Posted Re: extract month and a year from date time field on SAS Programming. 06-09-2017 03:06 PM
- Posted Re: extract month and a year from date time field on SAS Programming. 06-09-2017 03:05 PM
- Posted extract month and a year from date time field on SAS Programming. 06-09-2017 02:48 PM
- Posted Re: how to send emails to recipients extracted from the dataset on SAS Programming. 05-31-2017 07:59 PM
- Posted how to send emails to recipients extracted from the dataset on SAS Programming. 05-31-2017 03:52 PM
- Posted ODS HTML process - how to disable pop up window on SAS Programming. 05-30-2017 05:16 PM
- Posted ODS HTML process - showing a popup window on SAS Programming. 05-30-2017 04:46 PM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 2 5 1 -
My Liked Posts
Subject Likes Posted 1 07-13-2012 11:44 AM
05-12-2017
07:09 PM
I am able to execute the code. can you please advise where I have an extra end
... View more
05-12-2017
06:41 PM
good day,
I am reposting this question as it's not working as per my requirements...
---------------------------------------------requirement ------------------------------------------------------------------------------------
I need to calculate number of work days between 2 given dates (start and the end). I need to do a couple things
1) I want to exclude weekends (sat and sunday) from my count
2) and I want to exclude company holidays (6 days) from my count
as an example, if the start-date is May 1 2017 and the end-date is may may 19 2017. Assuming that May 4 and May 5 are company holidays, then I want the macro to return a count of 13... here is how it should count
M T W T F S S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19
--------------------------------------------------Sample Code -----------------------------------------------------------------
data wrkdays (keep=begin); format begin date9.; array holidays(6); do date = '01jan1971'd to '31dec2070'd ; if date eq intnx('year',date,0,'b') then do; call missing(of holidays(*)); i=0; end; if date eq holiday('NEWYEAR', year(date)) or date eq holiday('USINDEPENDENCE',year(date)) or date eq holiday('THANKSGIVING', year(date)) or date eq holiday('CHRISTMAS', year(date)) or date eq holiday('MEMORIAL', year(date)) or date eq holiday('LABOR', year(date)) then do; i+1; holidays(i)=date; end; if not(date in holidays or weekday(date) in (1,7)) then do; season=1; begin=date; output; end; end; run;
options intervalds=(workdays=wrkdays);
data temp; set db.v_data (where = (&date1 <= sch_dt < &date2 ));
workdays = intck('workdays',datepart(Start_Date), datepart(End_date));
run;
-------------------------------------------------------Issue ------------------------------------------------
the above code is working fine for my requirement # 1, which is to exlcude weekend days from the count. BUT, it's not working for requirement #2, which is to exclude holidays from the count
please advise
... View more
05-10-2017
06:52 PM
How to save SAS Dataset in a c drive and acess it.
A) save dataset
here is something I've used to save excel file. how will it work for sas dataset
%let YYYYMM = 201703;
data _null_; file cmds; put "[save.as(%bquote("C:\Program Files\output\DataSet &YYYYMM..xlsx"))]"; put '[CLOSE()]'; run;
B) import dataset
can you please advise how to import dataset in a sas program
Thanks
... View more
05-10-2017
04:40 PM
Hi,
---------------Background -----------------------------------------------------------------
I have 2 files (A. Current year and B. Previous year) in which I am tracking courses offered by Location and the pass/fail ratio
---------------Requirement -----------------------------------------------------------------
in the current year file, I want to show progress with colors using following criteria
1) if the % Pass in both the years are > 80%, then, mark it green in the current year file
2) if the % Pass in both the years are < 80%, then, mark it red in the current year file
3) if the % Pass in any one year is < 80% and the other is > 80%, then, mark it yellow in the current year file
Example
Please note that the excel files for both the files are identifcal, only the values change
Please advise how to accomplish it
Thanks
... View more
05-10-2017
04:28 PM
Thanks again for your assistance
... View more
05-10-2017
01:35 PM
it worked with following change workdays = intck('workdays', datepart(start_date), datepart(end_date));
... View more
05-10-2017
01:08 PM
here is what I did... ran a code similar to the one below
data wrkdays (keep=begin);
format begin date9.;
array holidays(6);
do date = '01jan1971'd to '31dec2070'd ;
if date eq intnx('year',date,0,'b') then do;
call missing(of holidays(*));
i=0;
end;
if date eq holiday('NEWYEAR', year(date)) or
date eq holiday('USINDEPENDENCE',year(date)) or
date eq holiday('THANKSGIVING', year(date)) or
date eq holiday('CHRISTMAS', year(date)) or
date eq holiday('MEMORIAL', year(date)) or
date eq holiday('LABOR', year(date)) then do;
i+1;
holidays(i)=date;
end;
if not(date in holidays or weekday(date) in (1,7)) then do;
season=1;
begin=date;
output;
end;
end;
run;
options intervalds=(workdays=wrkdays);
data test; set DB.v_all_2017 (where = (&date1 <= sched_dt < &date2)); days =intck('workdays','1may2017'd,'19may2017'd); workdays = intck('workdays', start_date, end_date);
run;
-----issue ----------------------------------------------
the count of days are coming just fine but the workdays field is showing 0 values for all the fields
----Output ---------------------------------------------
my table looks something like this (with workdays showing 0 values)... it works when I pass a fixed date value
Table: v_all_2017
start_date
end_date
workdays
days
24JAN2017:09:45:00.000
08FEB2017:15:30:00.000
0
14
28JAN2017:00:35:00.000
08FEB2017:17:30:00.000
0
14
03FEB2017:08:49:10.940
07FEB2017:14:35:00.000
0
14
Please adviase
... View more
05-09-2017
08:56 PM
here is the code that I've used
%let date = feb2017; %let date1 = '01feb2017'd; %let date2 = '01mar2017'd; options intervalds=(WorkDays=WorkDayDS);
data WorkDayDS(keep=BEGIN); start = '15DEC1998'D; stop = '15JAN2030'D; nwkdays = INTCK('WEEKDAY',start_Date,End_date); do i = 0 to nwkdays; BEGIN = INTNX('WEEKDAY',start_Date,i); year = YEAR(BEGIN); if BEGIN ne HOLIDAY("NEWYEAR",year) and BEGIN ne HOLIDAY("MEMORIAL",year) and BEGIN ne HOLIDAY("USINDEPENDENCE",year) and BEGIN ne HOLIDAY("LABOR",year) and BEGIN ne HOLIDAY("THANKSGIVING",year) and BEGIN ne HOLIDAY("CHRISTMAS",year) then output; end; format BEGIN DATE.; run; proc sql; create table temp2 as select *, INTCK('WorkDays',Start_Date,End_date)/(60*60*24) as workdays from DB.v_all_2017 where &date1 <= sched_dt < &date2;
-------------------------------
Issue 1: the output has 0 values for all the columns
Issue 2: if the holiday is on the weekend, then it's not switching... my other code that I've posted previously was switching the days perfectly but I don't know how to use it in the code above
Thanks
... View more
05-09-2017
06:52 PM
yes, I am in US and want to factor in following hollidys
Memorial Day
Independence Day
Labor Day
Thanksgiving Day
Christmas Day
New Year's Day
Thanks
... View more
05-09-2017
05:42 PM
Hi,
I've tried a few things and nothing worked so far. here is what I am trying to do
current query
proc sql;
select (date_end-date_start) as Calender_days
from
Table_A;
this query return calander days between start and the end date
I want the same query to now return only the work days minus Holidays (selected ones)... here is the script that I found to identify the holidays but I am unable to figure out the logic
data holidays ; length HolidayName $ 30 ; array WkDayShift [7] _temporary_ ( 1 5*0 -1 ) ; retain ShiftToggle /* 0 */ 1 ; do Year = 1971 to 2070 ; HolidayName = "New Year's Day" ; * 1 Jan if not Mon 2 Jan. ; HoliDate = holiday('newyear', year) ; dow = weekday(HoliDate) ; HoliDate = intnx( 'day', HoliDate, WkDayShift[dow] * ShiftToggle ) ; if not ( (dow EQ 7) and ShiftToggle ) then output ; HolidayName = "Martin Luther King Day" ; * 3rd Mon in Jan ; HoliDate = holiday('mlk', year) ; output ; HolidayName = "Presidents' Day" ; * 3rd Mon in Feb ; HoliDate = holiday('uspresidents', year) ; output ; HolidayName = "Memorial Day" ; * Last Mon in May ; HoliDate = holiday('memorial', year) ; output ; HolidayName = "Independence Day" ; * 4 Jul if not Mon 5 Jul or Fri 3 Jul ; HoliDate = holiday('usindependence',year) ; HoliDate = intnx('day', HoliDate, WkDayShift[ weekday(HoliDate) ] * ShiftToggle) ; output ; HolidayName = "Labor Day" ; * 1st Mon in Sep ; HoliDate = holiday('labor', year) ; output ; HolidayName = "Thanksgiving Day" ; *4th Thu in Nov ; HoliDate = holiday('thanksgiving', year) ; output ; HolidayName = "Christmas" ; * 25 Dec if not Mon 26 Dec or Fri 24 Dec ; HoliDate = holiday('christmas', year) ; HoliDate = intnx('day', HoliDate, WkDayShift[ weekday(HoliDate) ] * ShiftToggle) ; output ; HolidayName = "New Year's Eve" ; * Fri 31 Dec or not at all ; HoliDate = mdy(12, 31, year) ; if weekday(HoliDate) EQ 6 and ShiftToggle then output ; end ; keep year HolidayName HoliDate ; format HoliDate weekdate17. ; run ;
proc print data=holidays ; where year in (2017, 2018) ; by year ; id year ; run ;
Thanks in advance
... View more
05-04-2017
05:44 PM
good day,
I need to calculate number of work days between 2 given dates (start and the end). I need to do a couple things
1) I want to exclude weekends (sat and sunday) from my count
2) and I want to exclude company holidays (6 days) from my count
as an example, if the start-date is May 1 2017 and the end-date is may may 19 2017. Assuming that May 4 and May 5 are company holidays, then I want the macro to return a count of 13... here is how it should count
M T W T F S S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19
Please advise
... View more
04-28-2017
07:30 PM
Hi,
We send out reports via email. we have one project for each report and each report is sent out individually to multiple recipients
usually we run the sas code that generates an output in excel and then we manually send our emails and make attachments. The reason we do it is to ensure that we are not sending out garbage files (incase data is missing)
is there a way we can automate this process (with some sanity check, something like do a count of records and if the count is in between a defined range for the given report then send it out otherwise generate an error email to notify whoever looks after that report)?
Please assist
Thanks, in advance
... View more
04-28-2017
06:43 PM
still getting an error message
------------------code used -------------------
%let Run_Pgm_List = C:\Temp\test;
data _null_; length Run_Pgm_List $ 1024; Run_Pgm_List = symget('Run_Pgm_List'); pgm_count = countw(Run_Pgm_List, '*'); if pgm_count ge 1 then do pgm_num = 1 to pgm_count; pgm_name = scan(Run_Pgm_List, pgm_num, '*'); call execute('%include "' !! strip(pgm_name) !! '.sas";'); end; end; run;
-------------------log details ---------------------------
37 %let Run_Pgm_List = C:\Temp\test; 38 39 data _null_; 40 length Run_Pgm_List $ 1024; 41 Run_Pgm_List = symget('Run_Pgm_List'); 42 pgm_count = countw(Run_Pgm_List, '*'); 43 if pgm_count ge 1 then do pgm_num = 1 to pgm_count; 44 pgm_name = scan(Run_Pgm_List, pgm_num, '*'); 45 call execute('%include "' !! strip(pgm_name) !! '.sas";'); 46 end; 47 end; --- 161 ERROR 161-185: No matching DO/SELECT statement.
48 run;
NOTE: The SAS System stopped processing this step because of errors. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.01 seconds
... View more
04-27-2017
06:40 PM
Hi Ran the following code and got the error message
--------------Here is the code that I ran --------------------------
%let Run_Pgm_List = 'M:\ABC Documents\ABC PROJECT\Mgmt. Reports\Reports in Progress\MYREPORTS\01_cnnDT\pgm\ReportNew - Auto;
data _null_; length Run_Pgm_List $ 1024; Run_Pgm_List = symget('Run_Pgm_List'); pgm_count = countw(Run_Pgm_List, '*'); if pgm_count ge 1 then do pgm_num = 1 to pgm_count; pgm_name = scan(Run_Pgm_List, pgm_num, '*'); call execute('%include ' !! strip(pgm_name) !! '.sas";'); end; end; run;
-----------------------Here is the log -------------------------
27 data _null_; 28 length Run_Pgm_List $ 1024; 29 Run_Pgm_List = symget('Run_Pgm_List'); 30 pgm_count = countw(Run_Pgm_List, '*'); 31 if pgm_count ge 1 then do pgm_num = 1 to pgm_count; 32 pgm_name = scan(Run_Pgm_List, pgm_num, '*'); 33 call execute('%include ' !! strip(pgm_name) !! '.sas";'); 34 end; 35 end; --- 161 ERROR 161-185: No matching DO/SELECT statement.
36 run;
NOTE: The SAS System stopped processing this step because of errors. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
... View more
04-27-2017
12:22 PM
Excellent!
can you please advise how to run multiples files if they are in a different folder, something like this
c:\temp Folder\ File 1.sas
c:\temp Folder 2\ File 2.sas
c:\temp Folder 3\ File 3.sas
thanks again for your assistance
... View more