02-02-2018
hondahawkrider
Fluorite | Level 6
Member since
02-23-2016
- 19 Posts
- 2 Likes Given
- 0 Solutions
- 1 Likes Received
-
Latest posts by hondahawkrider
Subject Views Posted 1075 05-19-2017 10:55 AM 1136 05-17-2017 04:29 PM 2976 05-11-2017 12:15 PM 1531 03-29-2017 07:11 PM 1535 03-29-2017 06:44 PM 1539 03-29-2017 06:24 PM 1561 03-29-2017 02:47 PM 1315 02-01-2017 06:41 PM 6628 01-05-2017 04:13 PM 6638 01-05-2017 03:56 PM -
Activity Feed for hondahawkrider
- Got a Like for SAS Automation - Export. 01-31-2018 06:27 AM
- Posted Re: getting totals of individual variable in a column on SAS Programming. 05-19-2017 10:55 AM
- Posted getting totals of individual variable in a column on SAS Programming. 05-17-2017 04:29 PM
- Liked Re: Proc Import csv but need to delete last line for art297. 05-12-2017 09:31 AM
- Posted Proc Import csv but need to delete last line on SAS Programming. 05-11-2017 12:15 PM
- Posted Re: Grafout 2 seperate graphs on Graphics Programming. 03-29-2017 07:11 PM
- Posted Re: Grafout 2 seperate graphs on Graphics Programming. 03-29-2017 06:44 PM
- Posted Re: Grafout 2 seperate graphs on Graphics Programming. 03-29-2017 06:24 PM
- Posted Grafout 2 seperate graphs on Graphics Programming. 03-29-2017 02:47 PM
- Posted SAS Automation-Running a report for JUST a few previous days... on SAS Programming. 02-01-2017 06:41 PM
- Posted Re: Proc Export to CSV issue - need to change csv tab name on SAS Programming. 01-05-2017 04:13 PM
- Posted Proc Export to CSV issue - need to change csv tab name on SAS Programming. 01-05-2017 03:56 PM
- Posted Re: SAS Automation - Export on SAS Programming. 11-29-2016 10:06 AM
- Posted SAS Automation - Export on SAS Programming. 11-29-2016 09:49 AM
- Posted Re: SAS - Automation - Script needs to automatically switch to a date (named) specific folder on SAS Programming. 02-24-2016 02:30 AM
- Liked Re: SAS - Automation - Script needs to automatically switch to a date (named) specific folder for Kurt_Bremser. 02-24-2016 02:30 AM
- Posted Re: SAS - Automation - Script needs to automatically switch to a date (named) specific folder on SAS Programming. 02-24-2016 02:21 AM
- Posted Re: SAS - Automation - Script needs to automatically switch to a date (named) specific folder on SAS Programming. 02-24-2016 01:26 AM
- Posted Re: SAS - Automation - Script needs to automatically switch to a date (named) specific folder on SAS Programming. 02-23-2016 07:11 PM
- Posted Re: SAS - Automation - Script needs to automatically switch to a date (named) specific folder on SAS Programming. 02-23-2016 06:06 PM
-
Posts I Liked
-
My Liked Posts
Subject Likes Posted 1 11-29-2016 09:49 AM
05-19-2017
10:55 AM
To answer the question of what i would think it would look like, it's be muliple proc summary for each type of form like for 13 type forms type status int_dt latency date hour 13 A 09MAY17:11:21:00 25 20948 11 13 A 09MAY17:11:21:15 30 20948 11 13 A 09MAY17:11:21:15 32 20948 11 and type 4 type status int_dt latency date hour 4 A 09MAY17:11:21:00 219 20948 11 4 A 09MAY17:11:21:15 20 20948 11 4 A 09MAY17:11:21:15 29 20948 11 4 A 09MAY17:11:21:15 20 20948 11 and so on... it's just seperating out things by form type... From there I can total things out individually by each form type as necessary... Thanks in Advance
... View more
05-17-2017
04:29 PM
9.3 Enterprise Guide I have sas progam that inports log file info which looks like this - but it's thousands of lines.. Form, Status, InputDate, ProcessedDate 4 `R `05/09/2017 11:21:37 `05/09/2017 11:22:15 4A `R `05/09/2017 11:21:32 `05/09/2017 11:22:18 13 `A `05/09/2017 11:21:47 `05/09/2017 11:22:21 The sas program does a great job of caluclating the average time between the input date and received date (latency) for all the forms type based upon interval I use (say 15mins) via a data statement (data t (keep=int_dt date hour latency type status) ;) Any my data comes out like this .. type status int_dt latency date hour 13 A 09MAY17:11:21:00 25 20948 11 47 A 09MAY17:11:21:00 69 20948 11 28 A 09MAY17:11:21:00 65 20948 11 4 A 09MAY17:11:21:00 219 20948 11 4 A 09MAY17:11:21:15 20 20948 11 13 A 09MAY17:11:21:15 30 20948 11 4 A 09MAY17:11:21:15 29 20948 11 4A A 09MAY17:11:21:15 28 20948 11 4A R 09MAY17:11:21:15 28 20948 11 13 A 09MAY17:11:21:15 32 20948 11 4A R 09MAY17:11:21:15 59 20948 11 4 A 09MAY17:11:21:15 20 20948 11 It's great and I love it - and it provides a great overall picture of everything, but now I need to drill down a bit... Basically I need to seperately split out the different form types 4, 4a, 13, etc, in addition to the overall picture and having a problem, thinking i could use a proc summary from t (name of data statement - see above) to split it by individual form types, but im not making much headway...... Any help is appreciated...
... View more
05-11-2017
12:15 PM
Have a script that works great proc import
datafile="c:\temp\input.csv"
replace
/*
out command below only keeps what var columns you need for data - missing vars
represent empty columns
*/
out = data_read (keep = var1 var2 var4 var5 var11 var12)
dbms=csv
out=t2
;
guessingrows=32767
;
*getnames=yes - pulls the header names, only use if csv has headers
namerow will also tell you what line to get the names if necessary;
getnames=no
;
*Firstobs=9;
*datarow tells you what line to start;
datarow=9
;
DELIMITER=' '
;
run ;
proc contents ;
run ;
proc print ;
run ;
proc export
data=t2
outfile="C:\temp\output.csv"
dbms=csv
replace
;
run ; The problem is that the the input.csv file now contains the following statement " Elapsed: 00:14:43.61," at the end of the file So I am looking for way to delete the last line or find a way to delete rows that beging with "elapsed"
... View more
03-29-2017
07:11 PM
Thx.. Im working on it.. I am former SA with lots of bat/vb/bash scripting experience who is now doing performance engineering and new to SAS, I'm more on the practical side (Getting stuff to work), I have a worker who is a statistician and old school sas scriptor. When I do my own it's more modern based as i'm learning on my own as well as from him.. However, I get a lot of base scripts he has written and have to run with em... Thx again
... View more
03-29-2017
06:24 PM
Yep, I have two Filename statements one referencing each output string - there are &filesout and &filestrend.. I believe I have tried both of you suggestions but I think it might be the way I have done it... Here is the code cleaned up.. run ;
/**/
symbol1 interpol=join width=1 line=2 v=none color=red;
symbol2 interpol=join width=1 line=1 v=none color=black;
symbol3 interpol=join width=1 line=2 v=none color=red;
symbol4 interpol=join width=1 line=1 v=none color=blue;
symbol5 interpol=join width=1 line=1 v=none color=green;
run;
* THis is what creates the graph picture automatically;
ods listing;
filename grafout (
"&filesout"
);
goptions reset=goptions device=JPEG gsfname=grafout gsfmode=append
;
run;
proc gplot data= all ;
format int_dt datetime10. ;
title1 "Federal Latency (PROD) Chart" ;
title2 "Period: &begdt to &enddt" ;
title3 "Data grouped in &sync_int Second Intervals" ;
label int_dt = 'Date Time' ;
label latency_mean_seconds= 'latency' ;
legend1 order=('latency' 'latency_lclm' 'latency_mean' 'latency_uclm');
legend2 order=('receipt_cnt');
axis1 label=(angle=90 'Latency in Seconds') ;
plot
/**/ latency_lclm*int_dt /* */
latency_mean*int_dt
latency_uclm*int_dt
latency_mean_seconds*int_dt
/ overlay name="tgraph" hminor=0 legend=legend1
haxis=&begdt to &enddt by &ginterval vaxis=axis1
;
plot2 receipt_cnt*int_dt
/ overlay name="tgraph" legend=legend2 /***/
;
run;
proc export
data=ALL
outfile="&filesoutcsv"
dbms=csv
replace
;
run;
** Ive tried filename grafout here and it didn't work;
proc gplot data= accesst.all2 ;
format int_dt datetime10. ;
title1 "Submission Processing Control Chart Trend" ;
title2 "Period: &begdt_tr to &enddt_tr" ;
title3 "Data grouped in &sync_int Second Intervals" ;
label int_dt = 'Date Time' ;
label latency_mean_seconds= 'latency' ;
legend1 order=('latency');
legend2 order=('Acks_RFP');
axis1 label=(angle=90 'Latency in Seconds') logbase=10 logstyle=expand ;
plot latency_mean_seconds*int_dt
/ overlay name="tgraph" hminor=0 legend=legend1
haxis=&begdt_tr to &enddt_tr by &ginterval_tr vaxis=axis1;
;
run;
; the script exports &fileout fine, but i can't get it to give me another file for &filestrend using the same command later on in the script
... View more
03-29-2017
02:47 PM
I am using the following code that creates a SAS/Graph jpeg (used to be png) file for all my output from "proc gplot data= all" * THis is what creates the graph picture automatically;
*ods _all_ close;
ods listing;
* filename grafout "C:\Prod Ack Gen Time Data\2016\GZ\02.24.16\Test.png";
filename grafout (
"&filesout"
);
goptions reset=goptions device=JPEG gsfname=grafout gsfmode=append
;
*filename grafout clear;
run; my issue is that I have added another gplot to the script, ie "proc gplot data= accesst.all2" and the second graph is parameterized as " &filestrendout" What I need is to get an addtional SAS/Graph jpeg (or png) file created (it shows up correctly in my Results tab) However what ever I try doesn't work (adding &filestrendout to ODS, seperate ODS listing, etc), i only ever get 1 file and it's "&filesout" data (but it sometime uses the &filestrendout parameter setting).. I suspect my initial ODS listing uses some kind default naming convention and only gets me the "proc gplot data= all" graph, but I need both it and "proc gplot data= accesst.all2" as png or jpeg files.. It can be seperate files, or both graphs can be in the same file - doesn't matter... Here is "proc gplot data= all" proc gplot data= all ;
format int_dt datetime10. ;
*title1 "Submission Processing Control Chart" ;
title1 "Federal Latency (PROD) Chart" ;
*title2 "Mean Latency, Receipts " ;
title2 "Period: &begdt to &enddt" ;
title3 "Data grouped in &sync_int Second Intervals" ;
label int_dt = 'Date Time' ;
label latency_mean_seconds= 'latency' ;
/*
Receipts
IMF_Acks
BMF_Acks
FED_Acks
State_Acks
Total_Acks
RFP
Acks_RFP
receipt_cnt
latency_mean_seconds
legend2 order=('Rec' 'Total_Acks');
*/
*legend1 order=('latency_lclm' 'latency_mean_seconds' 'latency_uclm');
*legend1 order=('latency_mean_seconds' 'latency_95th_percentile');
legend1 order=('latency' 'latency_lclm' 'latency_mean' 'latency_uclm');
/*
legend2 order=('Acks_RFP');
*/
legend2 order=('receipt_cnt');
axis1 label=(angle=90 'Latency in Seconds') ;
*legend2 order=('Receipts');
plot
/**/ latency_lclm*int_dt /* */
latency_mean*int_dt
latency_uclm*int_dt
latency_mean_seconds*int_dt
/*** latency_95th_percentile*int_dt ***/
/** latency_uclm*int_dt * */
/ overlay name="tgraph" hminor=0 legend=legend1
haxis=&begdt to &enddt by &ginterval vaxis=axis1
;
/***
plot2 Acks_RFP*int_dt
/ overlay name="tgraph" legend=legend2 ***/
/***/
plot2 receipt_cnt*int_dt
/ overlay name="tgraph" legend=legend2 /***/
;
*by date ;
run; Here is proc gplot data= accesst.all2 proc gplot data= accesst.all2 ;
format int_dt datetime10. ;
title1 "Submission Processing Control Chart Trend" ;
*title2 "Mean Latency, Receipts " ;
title2 "Period: &begdt_tr to &enddt_tr" ;
title3 "Data grouped in &sync_int Second Intervals" ;
label int_dt = 'Date Time' ;
label latency_mean_seconds= 'latency' ;
*legend1 order=('latency' 'latency_lclm' 'latency_mean' 'latency_uclm');
legend1 order=('latency');
legend2 order=('Acks_RFP');
axis1 label=(angle=90 'Latency in Seconds') logbase=10 logstyle=expand ;
*legend2 order=('Receipts');
plot
/** latency_lclm*int_dt
latency_mean*int_dt
latency_uclm*int_dt */
latency_mean_seconds*int_dt
/*** latency_95th_percentile*int_dt ***/
/** latency_uclm*int_dt * */
/ overlay name="tgraph" hminor=0 legend=legend1
haxis=&begdt_tr to &enddt_tr by &ginterval_tr vaxis=axis1
;
/***
plot2 Acks_RFP*int_dt
/ overlay name="tgraph" legend=legend2 ***/
;
*by date ;
run; I don't know if it's "tgraph" being used in each or what.... I'm stumped .... Help.. Original script is in https://communities.sas.com/t5/Base-SAS-Programming/SAS-Automation-Export/m-p/315194/highlight/true#M68701 thanks in advance
... View more
02-01-2017
06:41 PM
Im a creature of my own sucess.. I have a current automated report that uses a file from the previous day that runs fantastic @4:30AM , so mgmt has a report waiting for them @ 6:00AM...... However, mgmt now would also like to see a seperate report that not only includes the previous day but the previous 3 days as well The current method is that I get a file at 4am that includes the previous days data that is dropped into a folder that is date based .. For example, the current file ie "core_fed_ack_gen_data02_01.tsv" is in folder "02.01.17"... So the following SAS script knows to find it that folder and to export it to another folder that also uses the "02.01.17" scheme.... The issue is that they also now want to see about 3 days of the previous data as well so they have it for comparison... This is my current code: data _null_;
xx = date();
yy = dhms(intnx('day',xx,-1),0,0,0);
zz = dhms(xx,3,0,0);
length
this_day this_month this_year $2
this_year4 $4
myfilename $100
;
this_day = put(day(xx),z2.);
this_month = put(month(xx),z2.);
this_year4 = put(year(xx),z4.);
this_year = substr(this_year4,3);
myfilename = 'C:\Users\username\Documents\MeF\automate\PROD\' !! this_year4 !!'\GZ\' !! put(xx,mmddyyp8.) !! '\core_fed_ack_gen_data' !! this_month !! '_' !! this_day !! '.tsv';
myoutputnm = 'C:\Users\username\Documents\MeF\automate\PROD\' !! this_year4 !!'\rpt\' !! put(xx,mmddyyp8.) !! '\core_fed_ack_gen_data' !! this_month !! '_' !! this_day !! '.png';
myoutputcsv = 'C:\Users\username\Documents\MeF\automate\PROD\' !! this_year4 !!'\rpt\' !! put(xx,mmddyyp8.) !! '\core_fed_ack_gen_data' !! this_month !! '_' !! this_day !! '.csv';
call symput('filepath',strip(myfilename));
call symput('filesout',strip(myoutputnm));
call symput('filesoutcsv',strip(myoutputcsv));
call symput('begdt',"'"!!put(yy,datetime18.1)!!"'dt");
call symput('enddt',"'"!!put(zz,datetime18.1)!!"'dt");
/*
%let begdt = '23Feb16 00:00:00.0'dt ;
%let enddt = '24Feb16 03:00:00.0'dt ;
*/
%let sync_int = 600;
%let ginterval='01:00:00.0't ;
run ;
%put filepath=&filepath;
%put filesout=&filesout;
%put begdt=&begdt;
%put enddt=&enddt;
filename filein (
"&filepath"
);
....SAS code.. to crunch the data file .
proc export
data=ALL
outfile="&filesoutcsv"
dbms=csv
replace
; It's not to difficult to flag some additional days as value/parameter... basically this to go back 3 more days yy = dhms(intnx('day',xx,-4),0,0,0); ie the -4 to go back a few days....The problem I am running into in how to specify folders ... right now it picks up the folder in myfilename = 'C:\Users\username\Documents\MeF\automate\PROD\' !! this_year4 !!'\GZ\' !! put(xx,mmddyyp8.) !! '\core_fed_ack_gen_data' !! this_month !! '_' !! this_day !! '.tsv'; This code goes to C:\Users\username\Documents\MeF\automate\PROD\2017\GZ\02.01.17 to grab the .tsv file... However, I now need it to to back to C:\Users\username\Documents\MeF\automate\PROD\2017\GZ\01.29.17 thru 02.01.17 I figured I could try and leverage this command this_day = put(day(xx),z2.); and create something like this_day = put(day(xx),z2.);
this_dayb2 = put(day(xx, -1),z2.);
this_dayb3 = put(day(xx, -2),z2.);
this_dayb4 = put(day(xx, -3),z2.); but I don't know how to add it to the the "myfilename".. Im close, but missing something.. Thanks in advance
... View more
01-05-2017
04:13 PM
Im just trying to find out if in the dbms section .. if there is a way for SAS to NOT have it so the tab name is the same as the file name, but rather something generic.. I can alter my SAS script so it's using a more generic named file, but I like having the date in the file name if possible
... View more
01-05-2017
03:56 PM
I have a scipt - that runs great, it does a proc export to a .csv file file. It's dynamic (see https://communities.sas.com/t5/Base-SAS-Programming/SAS-Automation-Export/td-p/315194) for the full script... My issue is that while it run great, the CSV ouput that is created also creates the data with a tab name that is the same as the outout file name.. So if my output is core_fed_ack_gen_data_12_06_182127.csv then the tab name inside the csv is core_fed_ack_gen_data_12_06_182 (it cuts off a few chars - but no biggie).. What I would like to do is find a way to genericize just the tab name to core_fed_ack_gen_data or even just sheet 1 or whatever... Thanks in advance proc export data=ALL outfile="C:\Users\d7dmb\Documents\core_fed_ack_gen_data_12_06_182127.csv" dbms=csv replace
... View more
11-29-2016
10:06 AM
It exports fine manually using proc export
data=ALL
outfile="C:\temp\filename_ALL.csv"
dbms=csv
replace
; It's just I am trying to leverage the myfilename and myoutput name values in the same way I get the png..
... View more
11-29-2016
09:49 AM
1 Like
I have an automated script that run daily that automatically grabs a .tsv log file from a dynamically named file/folder (based upon the date - MM.DD.YY) that automatically creates a png graph with a dynamic name as well also based upon the date (output is name_of_file_MM_DD).. I love it - works great... However, other projects want to see the raw data for the graph... Im trying to export this data as part of the automated process and running into some wall.. I can do it manually by exporting the "ALL" spreadsheet from "Output Data" manually without a problem but am running into a problem automating it.. Ultimately, I would like to do BOTH the graph and the spreadsheet - but really need the spreadsheet... Here is code ******************************************************************;
options obs=10000000;
data _null_;
xx = date();
*yy = dhms(intnx('day',xx,-1),0,0,0);
*yy above is for one day previous ie -1 for midnight ;
yy = dhms(intnx('day',xx, 0),9,0,0);
* Today's date DHMS is day hour minutes seconds;
*zz = dhms(xx,3,0,0);
*zz above is for 3 am changing the 3 to 0 changes it to 12am of today's data;
zz = dhms(xx,21,0,0);
length
this_day this_month this_year $2
this_year4 $4
myfilename $100
;
this_day = put(day(xx),z2.);
this_month = put(month(xx),z2.);
this_year4 = put(year(xx),z4.);
this_year = substr(this_year4,3);
myfilename = 'C:\Prod Ack Gen Time Data\PETE\' !! this_year4 !!'\GZ\' !! put(xx,mmddyyp8.) !! '\core_fed_ack_gen_data' !! this_month !! '_' !! this_day !! '.tsv';
myoutputnm = 'C:\Prod Ack Gen Time Data\PETE\' !! this_year4 !!'\rpt\' !! put(xx,mmddyyp8.) !! '\core_fed_ack_gen_data' !! this_month !! '_' !! this_day !! '.png';
call symput('filepath',strip(myfilename));
call symput('filesout',strip(myoutputnm));
call symput('begdt',"'"!!put(yy,datetime18.1)!!"'dt");
call symput('enddt',"'"!!put(zz,datetime18.1)!!"'dt");
/*
%let begdt = '23Feb16 00:00:00.0'dt ;
%let enddt = '24Feb16 03:00:00.0'dt ;
*/
/*
%let sync_int = 600;
%let ginterval='01:00:00.0't ;
*/
%let sync_int = 60;
%let ginterval='00:15:00.0't ;
run ;
%put filepath=&filepath;
%put filesout=&filesout;
%put begdt=&begdt;
%put enddt=&enddt;
/*
filename filein (
'c:\Users\XBWKB\My Documents\SE\ack\core_0325_00am_fed_data.tsv'
*/
/*
filename filein (
/*
* Note sometimes the time parameter changes
'C:\Prod Ack Gen Time Data\2016\GZ\02.10.16\core_state_ack_gen_data02_10_031502.tsv'
'C:\Prod Ack Gen Time Data\2016\GZ\02.24.16\core_state_ack_gen_data02_24_031500.tsv'
);
*/
filename filein (
"&filepath"
);
/*
'c:\Users\XBWKB\My Documents\SE\ack\core_0325_00am_fed_data.tsv'
'c:\Users\XBWKB\My Documents\SE\ack\core_0325_6am_fed_data.tsv'
'c:\Users\XBWKB\My Documents\SE\ack\core_0316_2days_fed_data.tsv'
'c:\Users\XBWKB\My Documents\SE\ack\core_0316_2days_fed_data.tsv'
'c:\Users\XBWKB\My Documents\SE\ack\core_0224_fed_data.tsv'
'c:\Users\XBWKB\My Documents\SE\ack\core_0224_state_data.tsv'
1040 `A `02/23/2015 19:45:28 `02/23/2015 19:45:49
• Four (4) columns of data as follows:
o submission_type
o Status (accepted/Rejected or RFP)
o receipt time (as date/time)
o ack time (as date/time)
*/
* ie. %sync(ttime,60) ==> '10:00:00't where ttime = '09:59:32't ;
%macro sync (
value ,
interval ) ;
if mod(&value,&interval) >= &interval*.5 then
&value = &interval * int(&value/&interval) + &interval ;
else
&value = &interval * int(&value/&interval) ;
%mend sync ;
data t (keep=int_dt date hour latency type status) ;
infile filein firstobs=1 missover dsd ;
length
tstr
$ 100
p1
p4
type
status
$ 30
;
input tstr ;
format int_dt ack_dt datetime. ;
format rec_date ack_date date. ;
p1 = scan(tstr,3,"`") ;
p4 = scan(tstr,4,"`") ;
type = left(trim(scan(tstr,1,"`"))) ;
status = left(trim(scan(tstr,2,"`")));
* if type =' ' ;
* if status = ' ' ;
Rec_Date = Input(scan(p1,1,' '),mmddyy10.) ;
*Rec_Time = Input(scan(p1,2,' '),time5.) ;
Rec_Time = Input(scan(p1,2,' '),time8.) ;
Ack_Date = Input(scan(p4,1,' '),mmddyy10.) ;
*Ack_Time = Input(scan(p4,2,' '),time5.) ;
Ack_Time = Input(scan(p4,2,' '),time8.) ;
if
Rec_Date = . or
Rec_Time = . or
Ack_Date = . or
Ack_Time = .
then do ;
c+1 ;
*put _all_ ;
delete ;
end ;
int_dt = dhms(Rec_Date, hour(Rec_Time), minute(Rec_Time), second(Rec_Time) ) ;
ack_dt = dhms(Ack_Date, hour(Ack_Time), minute(Ack_Time), second(Ack_Time) ) ;
*latency = (ack_dt - int_dt) / 3600 ;
latency = (ack_dt - int_dt) ;
*if latency <= 75 ; * Weed out outliers ;
If latency = . or latency < 0 then do ;
put 'howdy ' _all_ ;
delete ;
End ;
%sync(int_dt,&sync_int) ;
date = datepart(int_dt) ;
hour = hour(timepart(int_dt)) ;
if int_dt >= &begdt and int_dt < &enddt ;
/*
if int_dt >= '14apr15 18:40:00.0'dt and int_dt < '15apr15 00:10:00.0'dt then delete ;
*/
run ;
*proc print ;
run ;
proc sort ;
by date hour int_dt ;
run ;
*proc print ;
run ;
proc summary data=t ;
by date hour int_dt ;
var latency ;
output out=trec (DROP = _TYPE_ RENAME = (_FREQ_ = receipt_cnt))
mean (latency) = latency_mean_seconds
;
run ;
*proc print ;
*Title 'Receipts and Latency by date hour interval' ;
*sum receipt_cnt ;
run ;
proc summary data=t ;
var latency ;
output out=trec_conf
mean (latency) = latency_mean
lclm (latency) = latency_lclm
uclm (latency) = latency_uclm
stddev (latency) = latency_stddev
p95 (latency) = latency_95th_percentile
;
run ;
proc univariate data=t ;
Title1 'Analysis of Detail Data' ;
title2 ' ' ;
var latency ;
run ;
proc print ;
Title1 'Confidence intervals of Detail Data' ;
title2 ' ' ;
run ;
proc summary data=trec ;
var latency_mean_seconds ;
output out=trec_conf
mean (latency_mean_seconds) = latency_mean
lclm (latency_mean_seconds) = latency_lclm
uclm (latency_mean_seconds) = latency_uclm
stddev (latency_mean_seconds) = latency_stddev
p95 (latency_mean_seconds) = latency_95th_percentile
;
run ;
proc univariate data=trec ;
Title1 "Analysis of &sync_int second sample means" ;
title2 ' ' ;
var latency_mean_seconds ;
run ;
proc print ;
Title1 "Confidence intervals from &sync_int second sample means" ;
title2 ' ' ;
run ;
*Time Receipts IMF Acks BMF Acks FED Acks State Acks Total Acks RFP Total Acks + RFP ;
*02/17/2015 15:00 50 32 2 34 0 34 9 43 ;
data counts ;
*infile 'c:\Users\XBWKB\My Documents\SE\ack\Ack_48_hrs-2-17-15-marci.csv' dsd firstobs=2 missover ;
infile 'C:\Users\d7dmb\Documents\MeF\Prod Scripts\SAS\ack_rate_per_min_48hrs-2-22.csv' dsd firstobs=2 missover ;
drop
p1
counts_time
counts_time2
c
;
length
p1
$ 16
Receipts
IMF_Acks
BMF_Acks
FED_Acks
State_Acks
Total_Acks
RFP
Acks_RFP
8
;
input
p1
Receipts
IMF_Acks
BMF_Acks
FED_Acks
State_Acks
Total_Acks
RFP
Acks_RFP
;
Receipts = Receipts * 60;
IMF_Acks = IMF_Acks * 60;
BMF_Acks = BMF_Acks * 60;
FED_Acks = FED_Acks * 60;
State_Acks = State_Acks * 60;
Total_Acks = Total_Acks * 60;
RFP = RFP * 60;
Acks_RFP = Acks_RFP * 60;
format int_dt datetime. ;
format date date. ;
counts_date = Input(scan(p1,1,' '),mmddyy10.) ;
counts_time = Input(scan(p1,2,' '),time5.) ;
if
counts_date = . or
counts_time = .
then do ;
c+1 ;
*put _all_ ;
delete ;
end ;
int_dt = dhms(counts_date, hour(counts_time), minute(counts_Time), second(counts_Time) ) ;
%sync(int_dt,&sync_int) ;
hour = hour(timepart(int_dt)) ;
date = datepart(int_dt) ;
if int_dt >= &begdt and int_dt < &enddt ;
run ;
*proc print ;
title1 'Initial reads of MeF counts from IBM' ;
run ;
proc sort data=counts;
by date hour int_dt ;
run ;
*proc print ;
run ;
proc summary data=counts ;
by date hour int_dt ;
var
Receipts
IMF_Acks
BMF_Acks
FED_Acks
State_Acks
Total_Acks
RFP
Acks_RFP
;
output out=counts
sum=
;
run ;
*proc print ;
*Title1 'Counts from IBM totaled date hour int_dt' ;
title2 ' ' ;
run ;
data all ;
merge counts(in=incnt) trec(in=intrec);
by date hour int_dt ;
run ;
data all ;
c+1 ;
if c=1 then do ;
set trec_conf ;
retain
latency_lclm
latency_uclm
latency_mean
latency_stddev
latency_stddev_2
latency_95th_percentile
;
latency_uclm = latency_mean + latency_stddev * 2 ;
latency_lclm = latency_mean - latency_stddev * 2 ;
put _all_ ;
end ;
set all ;
drop c _type_ _freq_ ;
run ;
proc print ;
Title 'Final Print after merge' ;
sum
Receipts
IMF_Acks
BMF_Acks
FED_Acks
State_Acks
Total_Acks
RFP
Acks_RFP
receipt_cnt
;
run ;
/**/
*goptions colors=(black blue red);
*symbol1 interpol=spline line=2 width=2 value=triangle c=steelblue; *line=2 dotted;
symbol1 interpol=join width=1 line=2 v=none color=red;
symbol2 interpol=join width=1 line=1 v=none color=black;
symbol3 interpol=join width=1 line=2 v=none color=red;
symbol4 interpol=join width=1 line=1 v=none color=blue;
symbol5 interpol=join width=1 line=1 v=none color=green;
*symbol4 interpol=join width=1 line=1 v=none color=green;
/*
symbol1 interpol=join width=1 v=none color=black;
symbol2 interpol=join width=1 v=none color=blue;
symbol3 interpol=join width=1 v=none color=red;
symbol4 interpol=join width=1 v=none color=green;
*/
run;
* THis is what creates the graph picture automatically;
*ods _all_ close;
ods listing;
* filename grafout "C:\Prod Ack Gen Time Data\2016\GZ\02.24.16\Test.png";
filename grafout (
"&filesout"
);
goptions reset=goptions device=PNG gsfname=grafout;
run;
/* haxis=&begdt to &enddt by &ginterval */
proc gplot data= all ;
format int_dt datetime10. ;
title1 "Submission Processing Control Chart" ;
*title2 "Mean Latency, Receipts " ;
title2 "Period: &begdt to &enddt" ;
title3 "Data grouped in &sync_int Second Intervals" ;
label int_dt = 'Date Time' ;
label latency_mean_seconds= 'latency' ;
/*
Receipts
IMF_Acks
BMF_Acks
FED_Acks
State_Acks
Total_Acks
RFP
Acks_RFP
receipt_cnt
latency_mean_seconds
legend2 order=('Rec' 'Total_Acks');
*/
*legend1 order=('latency_lclm' 'latency_mean_seconds' 'latency_uclm');
*legend1 order=('latency_mean_seconds' 'latency_95th_percentile');
legend1 order=('latency' 'latency_lclm' 'latency_mean' 'latency_uclm');
/*
legend2 order=('Acks_RFP');
*/
legend2 order=('receipt_cnt');
axis1 label=(angle=90 'Latency in Seconds') ;
*legend2 order=('Receipts');
plot
/**/ latency_lclm*int_dt /* */
latency_mean*int_dt
latency_uclm*int_dt
latency_mean_seconds*int_dt
/*** latency_95th_percentile*int_dt ***/
/** latency_uclm*int_dt * */
/ overlay name="tgraph" hminor=0 legend=legend1
haxis=&begdt to &enddt by &ginterval vaxis=axis1
;
/***
plot2 Acks_RFP*int_dt
/ overlay name="tgraph" legend=legend2 ***/
/***/
plot2 receipt_cnt*int_dt
/ overlay name="tgraph" legend=legend2 /***/
;
*by date ;
run;
/*
plot2 Acks_RFP*int_dt Receipts*int_dt
latency_lclm*receipt_dt
latency_uclm*receipt_dt
plot latency_mean_seconds*receipt_dt / name="tgraph" hminor=0
haxis='18feb15:00:00:00'dt to '18feb15:23:59:00'dt by '01:00:00.0't
vaxis=-25 to 40 by 5 ;
plot latency_lclm*receipt_dt / name="tgraph" hminor=0
plot latency_uclm*receipt_dt / name="tgraph" hminor=0
;
*by date ;
plot low*year high*year / overlay
haxis=axis1
hminor=4
vaxis=axis2
vminor=1
caxis=black
areas=2;
run;
*/
... View more
02-24-2016
02:30 AM
That works Great!! Thanks
... View more
02-24-2016
02:21 AM
This totally rocks ... It does the filename path stuff fantastically... The only thing I have to do is incorporate how to also change %let begdt = '23Feb16 00:00:00.0'dt ; %let enddt = '24Feb16 03:00:00.0'dt ; so I get yesteday's and todays date in that format.. You given me a lot of food for thought.. Thanks
... View more
02-24-2016
01:26 AM
hmm.. thats what I thought I did.. what I have put is things I have tried to use to get the variables ... Pretty much everything in the script that I put can disappear or be deleted if need be.. Basically when I run it manually I have the following code to change %let begdt = '22Feb16 00:00:00.0'dt ;
%let enddt = '23Feb16 03:00:00.0'dt ;
%let sync_int = 600;
%let ginterval='01:00:00.0't ;
filename filein (
'C:\PROD\2016\GZ\02.23.16\data02_23_031500.tsv'
); So for today - ie the 24th - I have to make the following %let begdt = '23Feb16 00:00:00.0'dt ;
%let enddt = '24Feb16 03:00:00.0'dt ;
%let sync_int = 600;
%let ginterval='01:00:00.0't ;
filename filein (
'C:\PROD\2016\GZ\02.24.16\data02_24_031500.tsv'
); In the first line I change 22Feb16 to 23Feb16... It needs to be the previous day's date In the 2nd line I change 23Fed16 to 24Feb14 - it needs to be today's date and in the file name I have to change the Folder name freom 02.23.16 to 02.24.16 and the file name from data02_23_ to data02_24_ Basically it's a script that I run daily (manually). I am trying to use SAS to detect what day it is when it runs, and have it change those date fields - so I can set it to run on my SAS server each day without having to change any code... I was trying to use what was avabilable to me - but as you can see I am struggling with it... Ive been handed the script and am stuck.. Any help is greatly appreciated.... I tried the best I could to see if I could figure it out - but haven't figured it out yet
... View more