Report style

Reply
Occasional Contributor
Posts: 17

Report style

Hi All...!!
The first column of my report should resemble like below with their corresponding frequencies. for the missing value it has to displace with zero by using dummy variable.
Now my query is how to merge this titles with sub-titles??

-----------------------------------------

study population
   safety
   pre-protocol


Discontinued
   Reasons
   Fever
   lost follow up
   Adverse Event
   Completed study

---------------------------------------------
can anyone tell me how to solve the query?

Super User
Super User
Posts: 7,955

Re: Report style

Posted in reply to PavithraVinothan

Sorry, what is your query?  How is your data laid out, what do you mean by titles/sub-titles?

If I was doing the above table and I wanted RTF output then I could do the below:

proc sql;

     create table WANT

     (

          COL1 char(200)...

     );

     insert into WANT

     set     COL1="study population"

     set     COL1="^RTF'   'safety"

     ...;

quit;

You basically just need tom modify your columns string by using the various methods offered by SAS, proc report could compute a value to add spaces, you could datastep and add spaces.  Without further information is hard to help.

Occasional Contributor
Posts: 17

Re: Report style

I just started learning SAS so i'm finding difficult in getting those technical terms........

I have attached the RTF which i need to generate.


table.jpg
Super User
Super User
Posts: 7,955

Re: Report style

Posted in reply to PavithraVinothan

Yes, you are programming a Table (as in Tables/Listings/Figures) for a Clinical Study.  I would suggest that you first examine your company SOPs, standard programs/macros, and ask your programing team (or others in your programming team) about this.  There will probably be quite a few of these (maybe even identical to yours) done for other studies within your company that you can use as basis.

Occasional Contributor
Posts: 17

Re: Report style

No i'm not working..... 

Super User
Super User
Posts: 7,955

Re: Report style

Posted in reply to PavithraVinothan

Ok, so the following is in my style.  I expect most people will have their ways of creating these.  In your example there is few distinct rows so can do this by insert each time, I wouldn't normally write it by hand each time, but as a base example.

proc sql;
  /* Get big N */
  select  count(STUDENT)  
  into    :TOT
  from    HAVE;

  /* Create empty table */
  create table WANT
  (
    TOTAL char(200) label="Total Student",
    MIEKA char(200) label="Mieka~(N=%trim(&TOT.))"
  );

  /* Add values */
  insert into WANT
  set TOTAL="Total Student",
      MIEKA=strip(put(&TOT.,best.))
  set TOTAL="Passed",
      MIEKA=(select case  when count(distinct STUDENT)=0 the "-"
                          else strip(put(count(distinct STUDENT),best.))||" ("|| put((count(distinct STUDENT) / &TOT.) * 100,5.1)||")" end
             from HAVE where PASSED="Yes")
  set TOTAL="Boy Topper",
      MEIKA=""
  set TOTAL="  Maths",
      TOTAL=(select ...
  ...
;
quit;

proc report data=want style(column)={asis=on);
...
run;

Note that you need the asis=on option in your report otherwise it will remove the preceding blanks in the text.  You could also, as mentioned used RTF codes.  What this means is that you embed text within your character string which will get written directly to RTF.  You can do this by using the escapechar,

ods escapechar='^'; /* the carat could be any character */

then in your data have: "this is some text^RTF/'   ' with some added spaces".  More info on that here: Base SAS: ODS RTF

Ask a Question
Discussion stats
  • 5 replies
  • 215 views
  • 0 likes
  • 2 in conversation