Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

counter

Status
Not open for further replies.

kaeserea

Programmer
Feb 26, 2003
164
0
0
DE
Hi!

I'd like to count how often a stored process has been accessed by the visitors on my application on the sas portal. Does anybody know how?

I thought of writing a line in a file anytime somebody accesses the stored process. But because I have many visitors this would be a concurrent access to writing a file which would not work...

Best regards
Eva
 
Not sure if this works in the stored procedures world but this is what I do for the intranet web programs.



These lines are added to each program that is to be monitored.


* log request in file;
%INCLUDE "d:\prog\saslog.sas" ;
*******************************; quit;

This is the program that captures the macros from the web page request and puts it in a file.

* prog.saslog.sas created 7-16-2004 dje;
* program to run at the end of a web program to log activity in a file;
* expand use later initially done in bin level program ;


********************** build log file dje;
data log;*data data_v8.slkcsas2log;
length user port debug program service date time $25.;
user="&_rmtuser";
port="&_port";
debug="&_debug";
program="&_program";
service="&_service";
date="&sysdate";
time="&systime";
output;
proc print;run;

data data_v8.slkcsas2log;retain date time program
user debug service;
set data_v8.slkcsas2log log;
data jlkjl;h=4;output;run;
****************************************;




The following program provides my web output on who is using what programs.




***************************************************************;
* prog.saslog_view created 7-27-2004 *;
* *;
* *;
* Modified 8-4-04 get date value out of char value dje *;
****************************************************************;
goptions reset=global dev=gif570 ftext=swissl;

ods listing close;
ods html frame=_webout (dynamic title="SAS- saslog_view.sas" )
body=b.html
contents=c.html
path=&_tmpcat (url=&_replay)
rs=none;
*data _null_;
* file _webout;
* put 'Content-type: image/gif';
* put;
data oldusers;set data_v8.users;
proc sort;by user;run;

data a1; LENGTH ZMONTH $3.;set data_v8.slkcsas2log;
zyear= substr ( date,6,2);
zmonth= substr (date,3,3);
zday = substr (date,1,2);
zhour=substr(time,1,2);
zmin=substr(time,4,2);

year=input(zyear,4.);
*month=input(zmonth,2.);
day=input(zday,2.);
HOUR=input(zhour,2.);
MIN=input(zmin,2.);

*date=mdy(month,day,year);
*datex=date + ((hour*60 +min)/(24*60)) ;*format date MMDDYY8.;
*if datex="." then delete;


* where date > (today() -60);
DROP DATE;
data a2;set a1;
if zmonth = "JAN" then month=1;
if zmonth = "FEB" then month=2;
if zmonth = "MAR" then month=3;
if zmonth = "APR" then month=4;
if zmonth = "MAY" then month=5;
if zmonth = "JUN" then month=6;
if zmonth = "JUL" then month=7;
if zmonth = "AUG" then month=8;
if zmonth = "SEP" then month=9;
if zmonth = "OCT" then month=10;
if zmonth = "NOV" then month=11;
if zmonth = "DEC" then month=12;
date=mdy(month,day,year);
datex=date + ((hour*60 +min)/(24*60)) ;format date MMDDYY8.;
if date > (today() -60);
proc sort;by user;run;




data a3;merge oldusers a2;by user;run;




proc sort;by descending date descending time;run;
ods proclabel "log";
Title "saslog";
proc print;by descending date ;
var date time program user name ;
run;
*
HOUR MIN ZMONTH date datex day debug month port program service time user year zday zhour zmin zyear
;
*proc contents short data=a2;*run;
proc sort;by name descending date descending time;
ods proclabel "user";
Title "By User";
proc print;by name;
var date time program user name;
run;

proc sort;by program descending date descending time;
ods proclabel "program";
Title "By Program";
proc print;by program;
var date time program user name;
run;
data kjlkdjf;h=4;output;run;


data users;set a2;
keep user;
proc sort nodupkey;by user;
run;

data data_v8.users;merge oldusers users;by user;run;
Title "New Users to edit in database";
proc print;
where secure < 0;run;



data trends; set a2;
proc sort;by date;run;

proc means noprint n mean sum;by date;
output out=stats
n=n_Programs
mean=x_programs
std=s_programs;
data stat_graf;set stats;
proc sort;by date;run;
SYMBOL V=STAR C=RED;
SYMBOL2 V=CIRCLE C=BLUE;
SYMBOL3 V=DIAMOND C=DEY;
SYMBOL4 V=TRIANGLE C= VIV;
PROC SHEWHART DATA =stat_graf GOUT=work.tt ;*BY ;
IRCHART n_programs * date /
NPANELPOS=500
DES="SAS Web Requests Logged "
TURNHLABEL nohlabel nochart2
interval=week
NAME = "sasjobs"

;
TITLE H=2 F=CENTX "SAS Jobs";
RUN;


ods html close;

run;




I apologize for the cluttered code. It is what I use and has served me well.

dje
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top