Announcement

Collapse
No announcement yet.

Resolutionlog Report

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

  • Resolutionlog Report

    Resolutionlog Report

    Description
    A study report to create a listing of changes during the resolution period to data in first and second key data. It can be run for specific dates or date ranges, as well as on the entire resolutionlog dataset. To use a date enter it in the where clause box when running the report as "mm/dd/yyyy" format for a single date and for a range just put "mm/dd/yyyy - mm/dd/yyyy" or "mm/dd/yyyy - " for a range of a date to today's date.

    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 (Resolutionlog)
      • 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 (Resolutionlog)
      • Select the level for the report as Global (available to all studies) in the studies level selection box
      • Specify a description for the report (Resolutionlog)
      • 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 and patient 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
      • 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:
    **********************************************************************************************
    *
    * Generates: Listing of resolutionlog data by chosen date or date range 
    * Usage: This report will print a listing of the resolutionlog variables for first and second
    *        key information and can be subset by a date or date range input in the where clause when
    *				 running the program. The date(s) should be entered in the format of mm/dd/yyyy and the 
    *        ranges can be specified as 'mm/dd/yyyy - mm/dd/yyyy' or 'mm/dd/yyyy - ' for a date up to
    *        today. 
    *
    ************************************************************************************************;
    
    ** Dataset to check for valid dates/date ranges **;
    data _null_;
     length wherecls $100;
    
      dates="&whereclause";
      dates=compress(dates);
      d1=scan(dates,1,'-');
      d2=scan(dates,2,'-');
      hasdash=index(dates,'-');
      baddate=0;
      scope=0;
    
    	**Check for non-date characters or errors in string**;
    	if length(dates)>10 and ^hasdash then baddate=1;
    	if compress(dates,'0123456789/-')>'' then baddate=1;
    	if d1 > '' and input(d1,mmddyy10.)=. then baddate=1;
    	if d2 > '' and input(d2,mmddyy10.)=. then baddate=1;
    
    	if d1 > '' and d2='' and ^hasdash then scope=1;
    	if d1 > '' and hasdash and d2='' then scope=2;
    	if d1 > '' and hasdash and d2 > '' then scope=3;
    
    	wherecls='';
    
    	if ^baddate then do;
    		if d1 > '' then nd1=input(d1,mmddyy10.);
    		if d2 > '' then nd2=input(d2,mmddyy10.);
    		select(scope);
    			when(1) do;
    				wherecls="where datepart(datestamp) = "||compress(nd1);
    			end;
    			when(2) do;
    				wherecls="where datepart(datestamp) >= "||compress(nd1);
    			end;
    			when(3) do;
    				wherecls="where datepart(datestamp) >= "||compress(nd1)||" and datepart(datestamp) <= "||compress(nd2);
    			end;
    			otherwise wherecls='';
    		end;	
    	end;	
    
      call symput('mywhere',wherecls);
      call symput('baddt',baddate);
    run;
    
    ** Sorting the resolutionlog dataset for the variables that are needed in the output **;
    proc sort data=pviews.resolutionlog out=resolutionlog (keep=investigatornumber patientnumber pagenumber sequence 
                                                                datestamp visitnumber variable actiondescription username1 username2 
                                                                firstkeyformattedvalue secondkeyformattedvalue finalformattedvalue);
     by investigatornumber patientnumber;
    run;
    
    data report;
     set resolutionlog;
     &mywhere;
    run; 
    
    ** Macro to allow subsetting of the report by variables specified in the template **;
    %cpsubset(report);
    
    ******************************************;
    ** Call macro to check if any obs       **;
    ******************************************;
    %cpcheckobs(report);
     %macro doreport;
      %if &nobs > 0 and &baddt ne 1 %then %do;
    
        proc sort data = report;
         by investigatornumber patientnumber pagenumber;
        run;
    
        options missing='';
    
    	
        ** If any obs then produce report **;
        data report;
         set report;
          invpat=trim(left(investigatornumber))||'/'||trim(left(patientnumber));
        run;
      
        proc report data=report nowd;
         column datestamp invpat pagenumber sequence visitnumber variable actiondescription username1 username2 
                firstkeyformattedvalue secondkeyformattedvalue finalformattedvalue;
         define datestamp / width=16 'Datestamp';
         define invpat / width=8 'Inv/Pat';
         define pagenumber / width=6 'Page Number';
         define sequence / width=8 'Sequence';
         define visitnumber / width=6 'Visit Number';
         define variable / width=10 'Variable';
         define actiondescription / width=12 'Action Description';
         define username1 / width=8 '1st Key User';
         define username2 / width=8 '2nd Key User';
         define firstkeyformattedvalue / width=10 'Firstkey Formatted Value';
         define secondkeyformattedvalue / width=10 'Secondkey Formatted Value';
         define finalformattedvalue / width=10 'Final Formatted Value';
        run;
     
        options missing='.';
      %end;
      %else %if &nobs=0 %then %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;
      %else %if &nobs > 0 and &baddt=1 %then %do;
       ** If where clause is invalid then do not produce report **;
       %noreport(message=Note: The date or dates entered are invalid please enter a date or range of dates in the mm/dd/yyyy format);
      %end;   
     %mend doreport;
    %doreport;
    Attached Files
    Last edited by Ronni Rubenstein; 12-21-2009, 11:09 AM.
Working...
X