Announcement

Collapse
No announcement yet.

First Key Second Key

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • First Key Second Key

    First Key Second Key
    This report lists who frst keyed and second keyed a record and includes selections for InvestigatorNumber, PatientNumber and PageNumber.

    Output Example




    Report Setup
    First, under System Admin \ Reports \ Report Library, create a new program entry. You can do this by saving and importing the attached fistKeySecondKey.sas Report program or by cutting and pasting the code from the code block below into the code editor.




    Report Template Setup
    Next, under System Admin \ Reports \ Report Templates, add a new Global report template that points at the program added above. The report type must be Current Study Only. Add the selection criteria as shown in setup below;





    Report Code
    Code:
    proc sql;   
       create table report as
       select t.investigatorNumber, t.patientNumber, t.visitNumber, t.pageNumber,
             k.sequence, k.currentStatus, k.firstKey, k.secondKey
       from
       (select c.*, d.secondKey from
          (select a.*, b.firstKey
             from
             (select recordID, _trackingKey, sequence, statuscode as currentStatus label='Current Status'
                from psys._recordHeaders(&spw)
             ) as a left join
             (select _recordKey, userName as FirstKey label='First Key Entry'
                from pviews.systemlog
                where changeCode='A' and dataset='_RECORDHEADERS'
             ) as  b
             on a.recordid = b._recordKey
          ) as c
          left join
          (select _recordKey, userName as SecondKey label='Sencond Key Entry'
             from pviews.systemlog
             where variable='STATUSCODE' and dataset='_RECORDHEADERS' and newCharacterValue in ('V', 'P')
          ) as d
          on c.recordID = d._recordKey
       ) as k left join pviews.tracking as t
       on k._trackingKey = t.datetracked
       order by investigatorNumber, patientNumber, visitNumber, pageNumber, sequence;
    quit;
    
    
    
    %cpSubset(report);
    
    ** Put final report output into macro so I can **;
    %macro reportit;
       ** Call macro to check for observations **;
       %cpcheckobs(report);
    
       ** Check returned macro variable to see if there are any observations**;
       %if &nobs > 0 %then %do;
          ** if any obs then produce report **;
    
          proc print data=work.report l noobs;
             by investigatorNumber patientNumber;
          run;
    
       %end;
       %else %do;
          ** if no obs then call macro to write a note to the report **;
          %noreport(message=Note: For the selected criteria there is no data to display);
       %end;
    %mend reportit;
    
    
    ** Call Report macro **;
    %reportit;
    Attached Files
    Last edited by dkeesey; 07-14-2009, 02:12 PM.

  • #2
    Updated - With Dates

    Attached is updated report code which also includes the date of firstkey and date of secondkey entry as per the date and time of the audit record.
    Attached Files

    Comment

    Working...
    X