No announcement yet.

Record Inventory by Status with Page and Page Number

  • Filter
  • Time
  • Show
Clear All
new posts

  • Record Inventory by Status with Page and Page Number

    Record Inventory by Status w/Page Report

    This is a modified Record Inventory by Status report that also includes the Dataset and Page Number on the report.

    Instructions for adding the report program
    • Adding the program code
      • Go to System Administration
      • Go to Report Library
      • Add a new report
      • Enter a name for the report (Record Inventory by Status w/Page)
      • Select Type = Normal
      • Specify a Category
      • Import the program code (Attachment) or click edit and paste the program code (see below) into the editor window
      • The Code Changes Exist field should now say ‘Yes’
      • Click Save on the Report Library Window
      • Click Go Back to return to the Reports menu
    • Define the Report Template(s)
      • Go to Report Templates
      • Add a new Template
      • Enter a name in the name input field (Record Inventory by Status w/Page)
      • Select the level for the report as Global (available to all studies) in the studies level selection box
      • Specify a description for the report (Record Inventory by Status with Page)
      • Specify a Category
      • Set Report Type = Global System Data
      • In the program field, browse to select the program defined above
      • There are no pre processing or post processing programs to specify
      • In the Selection criteria past or set the following values to provide investigator, patient, and pagenumber selection
      • Investigator Selection
        • Data set = PVIEWS.INVESTIGATORS
        • Variable = INVESTIGATORNUMBER
        • Selection Label = Investigator Number
        • Dependant = N/A
        • Type = Multiple
      • Patient Selection
        • Data set = PVIEWS.ENROLLMENT
        • Variable = PATIENTNUMBER
        • Selection Label = Patient Number
        • Dependant = Yes
        • Type = Multiple
      • Page Number Selection
        • Data set = PVIEWS.PAGES
        • Variable = PAGENUMBER
        • Selection Label = Page Number
        • Dependant = No
        • Type = Multiple
      • On the output tab, set the layout to Landscape
      • To set a custom output such as HTML or PDF as opposed to the default SAS Text Output, on the output tab set the following:
        • Layout = Landscape
        • Check ‘Use ODS’
        • Type = HTML or RTF or PDF (for rtf or pdf you need to have word or acrobat installed on the server)
        • Set the style = RTF or Printer – You can play with this but I like these the best for reports.
      • Click Save to save the template
    Sample Output

    Program Code
            Generates an inventory of records by record status
    ** Define macro to produce report and check if there is any output **;
    %macro report;
        ** Sort data in from protocol view **;
        proc sort data=pviews.datasets out=work.reportdata;
        by datestamp;
        proc sort data=psys._recordheaders(&spw) out=work.reportrec1;
        by _datasetskey;
        ** Merge datasets and record headers data **;
        data work.reportrec(DROP=x);
        merge work.reportdata(rename=(datestamp=x)) work.reportrec1(rename=(_datasetskey=x));
        by x;
        if _trackingkey > . then output;
        ** Sort data in from protocol view **;
        proc sort data=pviews.tracking out=work.reporttrc;
        by datetracked;
        proc sort data=work.reportrec;
        by _trackingkey;
        ** Merge tracking and record headers data **;
        data patientNumber pageNumber datasetname status);
        length status $20;
        label status='Record Status';
        merge work.reporttrc(drop=status rename=(datetracked=x)) work.reportrec(rename=(_trackingkey=x));
        by x;
        if statusCode>'' then do;    
        if statusCode='P' then status='Partially Verified';
        else if statusCode='N' then status='Non-Verified';
        else if statusCode='V' then status='Verified';
        ** Sort data in from protocol view **;
        proc sort;
        by investigatorNumber patientNumber dataSetName pageNumber status;
        ** Check for subsets that were selected **;
        ** Call macro to check for observations **;
        %if &nobs > 0 %then %do;
            proc sort;
            by investigatorNumber patientNumber dataSetName PageNumber status;
            options missing='';
            proc TABULATE data=report;
            class investigatorNumber patientNumber dataSetName PageNumber status;
            table investigatorNumber*patientNumber*dataSetName*PageNumber all="Total for All",status all="Total Count for Patient";
            options missing='.';
        %else %do;
            ** if no obs then write a note to the report **;
            ** Create temp data set for note **;
                length Information $50;
                information='Note: There is no data to report on.';
            proc print noobs;
    %mend report;
    ** Call report macro **;
    Attached Files
    Last edited by ; 07-14-2009, 01:49 PM.