No announcement yet.

First Key Second Key

  • 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 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
    proc sql;   
       create table report as
       select t.investigatorNumber, t.patientNumber, t.visitNumber, t.pageNumber,
             k.sequence, k.currentStatus, k.firstKey, k.secondKey
       (select c.*, d.secondKey from
          (select a.*, b.firstKey
             (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;
    ** Put final report output into macro so I can **;
    %macro reportit;
       ** Call macro to check for observations **;
       ** Check returned macro variable to see if there are any observations**;
       %if &nobs > 0 %then %do;
          ** if any obs then produce report **;
          proc print l noobs;
             by investigatorNumber patientNumber;
       %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);
    %mend reportit;
    ** Call Report macro **;
    Attached Files
    Last edited by ; 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