Announcement

Collapse
No announcement yet.

Record Inventory by Status with Page and Page Number

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

  • Record Inventory by Status with Page and Page Number

    Record Inventory by Status w/Page Report

    Description
    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
    Code:
    /*****************************************************\
    
        Program record_inventory_by_status.sas
        
        Description:
            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;
        run;
        proc sort data=psys._recordheaders(&spw) out=work.reportrec1;
        by _datasetskey;
        run;
        
        ** 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;
        run;    
        
        ** Sort data in from protocol view **;
        proc sort data=pviews.tracking out=work.reporttrc;
        by datetracked;
        run;
        proc sort data=work.reportrec;
        by _trackingkey;
        run;
        
        ** Merge tracking and record headers data **;
        data work.report(KEEP=investigatorNumber 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';
        output;
        end;
        run;
    
        ** Sort data in from protocol view **;
        proc sort data=work.report;
        by investigatorNumber patientNumber dataSetName pageNumber status;
        run;
    
        ******************************************;
        ** Check for subsets that were selected **;
        ******************************************;
    
        %cpsubset(report);
        %cpwhere(report);
    
        ** Call macro to check for observations **;
        %cpcheckobs(report);
    
        %if &nobs > 0 %then %do;
    
            proc sort data=work.report;
            by investigatorNumber patientNumber dataSetName PageNumber status;
            RUN;
    
            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";
            run;
            options missing='.';
    
        %end;
        %else %do;
    
            ** if no obs then write a note to the report **;
        
            ** Create temp data set for note **;
            data work.report;
                length Information $50;
                information='Note: There is no data to report on.';
                output;
            run;
            proc print noobs;
            run;
        %end;
    
    %mend report;
    
    ** Call report macro **;
    %report;
    Attached Files
    Last edited by dkeesey; 07-14-2009, 02:49 PM.
Working...
X