BookmarkSubscribeRSS Feed
sam1231
Obsidian | Level 7

 

How can i write proc report code for this

 

lblCol  ("^\brdrb\brdrs\brdrw1 GRP" ("^\brdrb\brdrs\brdrw1 GRP1 ~ N=&bign2" cOL1 col2 col3)
                       ("^\brdrb\brdrs\brdrw1 GRP2~ N=&bign1" col4 col5 col6)
                       ("^\brdrb\brdrs\brdrw1 GRP3 ~ N=&bign3" col7 col8 col9))

How to add expected number row?

3 REPLIES 3
Cynthia_sas
SAS Super FREQ
Hi:
Without data, no one can test your code. Also, the screen shot you posted does not seem to correspond to anything. I don't see N= in your posted Word doc.

Where is the rest of your PROC REPORT code? What does your data look like?

Cynthia
sam1231
Obsidian | Level 7
options center nonumber nodate missing=' ' orientation=landscape;
ods listing close;
ods escapechar="^";
ODS RTF File = "&outdir\T_xx_rpt.rtf" style=Styles.standtemp;                              

Proc Report Data=REPORT Spacing=1 Split="~" HeadLine HeadSkip NoWd Wrap                           
                    style(report) = [outputwidth=100%]
                    Style(Header) = {font_weight=Bold}       ;

  column indent lblCol  ("^\brdrb\brdrs\brdrw1 GRP"  ("^\brdrb\brdrs\brdrw1 GRP1 ~ N=&bign2" cOL1 col2 col3)
                       ("^\brdrb\brdrs\brdrw1 GRP2 ~ N=&bign1" col4 col5 col6)
                       ("^\brdrb\brdrs\brdrw1 GRP3 ~ N=&bign3" col7 col8 col9)); 
    define indent / display noprint ;                           
  define lblCol / order=data left style={cellwidth=2.4cm just=left} " ";
  define cOL1 / display center style={cellwidth=1.2cm} " ~(N=&N1)";
  define cOL2  / display center style={cellwidth=1.2cm} "~(N=&N2)";
  define cOL3  / display center style={cellwidth=1.2cm} "~(N=&N3)";

    define cOL4 / display center style={cellwidth=1.2cm} " ~(N=&N4)";
  define cOL5  / display center style={cellwidth=1.2cm} "~(N=&N5)";
  define cOL6  / display center style={cellwidth=1.2cm} " ~(N=&N6)";

    define cOL7 / display center style={cellwidth=1.2cm} " ~(N=&N7)";
  define cOL8  / display center style={cellwidth=1.2cm} "~(N=&N8)";
  define cOL9  / display center style={cellwidth=1.2cm} "~(N=&N9)";


  compute before  _Page_ / style={just=l font_size=12pt font_weight=bold};
    line @1 "Table 2: xxx";
    line "^R/RTF'\brdrb\brdrs'";
  endcomp;

  compute lblCol;
  if indent=2 then lblCol='^R"\li400 "'||strip(lblCol);
  if indent=1 then lblCol='^R"\li200 "'||strip(lblCol);
  if indent=0 then call define ("lblCol","style", "style=[font_weight=bold]");
  endcomp;

  compute after / style={font_size=9pt};
  line @1 "^R/RTF'\brdrt\brdrs'";
  

  endComp; 



run;
ods rtf close;
ods listing;

We added N for each column and grp.

 

 

Cynthia_sas
SAS Super FREQ

Hi:

  I'm not exactly sure what the issue is, but I've made some notes below:

problem_RTF.png

 

1) I highlighted in pink the options that are LISTING only options and will be ignored by ODS RTF.

2) I highlighted in green several places where you are using ODS ESCAPECHAR to insert "raw text" RTF controls into the SAS output. One example (in the LINE statement at the bottom) is the old style form of ODS ESCAPE char. I would expect it to work. lWhat you show in the COLUMN statement (and I only highlighted the first 2 examples) probably is NOT working. You either need to correct this and/or switch to the new style raw text insertion function.

3) You are using a custom style template in the output -- nobody really knows what is in that template

4) Without data, no one can run your code to observe what the program is producing

 

  You may be better off working with Tech Support. They can look at ALL your code and ALL your data and help you figure out how to get what you want/need.

 

  Again, without data, your template and the values for your macro variables, no one can run your code. Tech Support can take a sample of your data or you can make some fake data that can be used to illustrate the problem you're having.

 

Hope this helps point you in the right direction.

 

Cynthia

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1922 views
  • 0 likes
  • 2 in conversation