<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to insert a text string at a particular observation in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7664#M2791</link>
    <description>Hi:&lt;BR /&gt;
  I have not explained PROC REPORT very well. &lt;B&gt;Proc Report is not creating "observations" it is writing report rows based on observations.&lt;/B&gt; The documentation contains a topic called "How PROC REPORT Builds a Report" which outlines this process step-by-step. It is a very useful explanation.&lt;BR /&gt;
 &lt;BR /&gt;
The report rows for a detail report do show you ALL the observations, but, PROC REPORT can only &lt;B&gt;display&lt;/B&gt; the observations that are in the DATA= data set. PROC REPORT can  "insert" extra/blank lines into the report -- but only at specific places, called break points (as described above in my first post). The break points where you can insert extra or blank lines are:&lt;BR /&gt;
1) at the top of the whole report or page for some destinations (COMPUTE BEFORE/COMPUTE BEFORE _PAGE_)&lt;BR /&gt;
2) at the bottom of the whole report or page for some destinations (COMPUTE AFTER/COMPUTE AFTER _PAGE_)&lt;BR /&gt;
3) at the top of a group of observations or at the top of a summary for a group of observations (COMPUTE BEFORE brkvar)&lt;BR /&gt;
4) at the bottom of a group of observations or at the bottom of a summary for a group of observations (COMPUTE AFTER brkvar)&lt;BR /&gt;
&lt;BR /&gt;
  In a detail report, on SASHELP.CLASS, the report row with "Jane" is NOT at a break point on the report, so there's no way to insert a line with text or a blank line into the report rows being built, using PROC REPORT. What I showed you -- putting the string "An American" into the same report cell on the report row with "Jane" is what you can do with PROC REPORT. (I've put a program at the bottom that illustrates exactly where you can insert lines into the report rows using PROC REPORT.)&lt;BR /&gt;
&lt;BR /&gt;
I'm still not sure I understand -exactly- what you want or why the insertion of arbitrary text is needed, but I think you have 2 choices --&lt;BR /&gt;
1)  Insert "new" observations into the data, you would would have to manipulate the data with a DATA STEP program and then pass the changed data to a report procedure (like PRINT or REPORT). &lt;BR /&gt;
2) Or, you could take control of report writing and use a DATA step program to write out report rows based on the observations in the input data set and the conditional logic you use in the program.&lt;BR /&gt;
&lt;BR /&gt;
At this point, we've gone back and forth several times and seem to be no closer to a solution for you. Perhaps the answer is PROC REPORT, perhaps the answer is data manipulation and inserting observations, perhaps the answer is a DATA _NULL_ report -- I think your best bet for help is to contact Tech Support. They can look at your data and your requirements and help you come up with the best solution.&lt;BR /&gt;
&lt;BR /&gt;
To send a question to Tech Support, go to &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt; and in the left-hand navigation pane, click on the link entitled "Submit a Problem".&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods listing;&lt;BR /&gt;
ods html file='c:\temp\shoes.html' style=sasweb;&lt;BR /&gt;
     &lt;BR /&gt;
proc report data=sashelp.shoes nowd;&lt;BR /&gt;
  column region product sales note;&lt;BR /&gt;
  where region in ('Asia', 'Canada');&lt;BR /&gt;
  define region /group;&lt;BR /&gt;
  define product / group;&lt;BR /&gt;
  define sales / sum;&lt;BR /&gt;
  define note /computed 'Manager Note';&lt;BR /&gt;
  break after region / summarize;&lt;BR /&gt;
  rbreak after / summarize;&lt;BR /&gt;
  compute note / character length=25;&lt;BR /&gt;
    if sales.sum lt 10000 then&lt;BR /&gt;
       note = 'Discontinue Item???';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute before _page_;&lt;BR /&gt;
    line 'COMPUTE BEFORE _PAGE_';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute before;&lt;BR /&gt;
    line 'COMPUTE BEFORE';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute before region;&lt;BR /&gt;
    line 'COMPUTE BEFORE REGION';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute after region;&lt;BR /&gt;
    region = 'SubTotal';&lt;BR /&gt;
    line 'COMPUTE AFTER REGION';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute after;&lt;BR /&gt;
    region = 'Total';&lt;BR /&gt;
    line 'COMPUTE AFTER';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute after _page_;&lt;BR /&gt;
    line 'COMPUTE AFTER _PAGE_';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]</description>
    <pubDate>Thu, 27 Mar 2008 15:09:03 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2008-03-27T15:09:03Z</dc:date>
    <item>
      <title>How to insert a text string at a particular observation</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7653#M2780</link>
      <description>Hi everyone,&lt;BR /&gt;
 I want to know how to insert a 'charecter string' at a particular observation in PROC REPORT.&lt;BR /&gt;
&lt;BR /&gt;
Thanks and regards.&lt;BR /&gt;
V.Siva rami reddy.</description>
      <pubDate>Tue, 25 Mar 2008 04:13:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7653#M2780</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-03-25T04:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert a text string at a particular observation</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7654#M2781</link>
      <description>Hi:&lt;BR /&gt;
  PROC REPORT does not change your input data set or your input observations. PROC REPORT writes report rows based on the input data set and the type of usage you define for particular variables (DISPLAY, ORDER or GROUP). So, if you want to insert a character string into your report rows (using PROC REPORT), your choices are:&lt;BR /&gt;
1) Insert text strings at the top or bottom of the report rows; or insert text strings at a break before of after a group of variables;&lt;BR /&gt;
2) Compute a new variable for only certain report rows;&lt;BR /&gt;
3) "Flag" a particular variable based on its observation position or on some other conditional criteria (in a compute block);&lt;BR /&gt;
4) Change the value of a variable in a compute block.&lt;BR /&gt;
&lt;BR /&gt;
If you need to alter an observation in a data set, then you should use a DATA step program to do that kind of data manipulation. If you need to insert text strings into report rows, then perhaps you can use SASHELP.CLASS to illustrate the kind of report you need to produce and where you would want the character string to be inserted.&lt;BR /&gt;
&lt;BR /&gt;
For example, SASHELP.CLASS has 19 observations:&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
  Name            Age     Height   &lt;BR /&gt;
  Alfred           14         69&lt;BR /&gt;
  Alice            13       56.5&lt;BR /&gt;
  Barbara          13       65.3&lt;BR /&gt;
  Carol            14       62.8&lt;BR /&gt;
  Henry            14       63.5   &lt;BR /&gt;
  James            12       57.3&lt;BR /&gt;
  Jane             12       59.8&lt;BR /&gt;
  Janet            15       62.5&lt;BR /&gt;
  Jeffrey          13       62.5&lt;BR /&gt;
  John             12         59&lt;BR /&gt;
  Joyce            11       51.3&lt;BR /&gt;
  Judy             14       64.3   &lt;BR /&gt;
  Louise           12       56.3&lt;BR /&gt;
  Mary             15       66.5&lt;BR /&gt;
  Philip           16         72&lt;BR /&gt;
  Robert           12       64.8&lt;BR /&gt;
  Ronald           15         67&lt;BR /&gt;
  Thomas           11       57.5&lt;BR /&gt;
  William          15       66.5&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
What kind of Text string would you want to insert into the above detail report? Using PROC REPORT Compute blocks, I could add '***' to the name on report row 5. So you'd see &lt;B&gt; Henry*** &lt;/B&gt; or I could insert a line of text after the last observation for William that said &lt;B&gt;"This is the end".&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
There are other ways to change the report. It is hard to show you any code without an idea of what you want to do.&lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 25 Mar 2008 05:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7654#M2781</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-03-25T05:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert a text string at a particular observation</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7655#M2782</link>
      <description>Hi Cynthia,&lt;BR /&gt;
for example, i want to insert a string 'An American'  before 'Jane'  and a string 'An Indian'  before 'John' .Now i think it is clear to you to solve my task.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Tue, 25 Mar 2008 07:39:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7655#M2782</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-03-25T07:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert a text string at a particular observation</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7656#M2783</link>
      <description>Are those text strings coming from another variable in the row, or are they completely arbitrary???? When you modify or add text to a variable value on a PROC REPORT row, you are bound by the size of the original variable. So, for example, the NAME field in SASHELP.CLASS has a length of 8 --- so you could not add the string "An American" before 'Jane' because of this rule. &lt;BR /&gt;
&lt;BR /&gt;
However, you can compute a new report item in the PROC REPORT row that used the name and my text string.&lt;BR /&gt;
&lt;BR /&gt;
In this output example, there are 2 report items: ITEM1 and ITEM2. ITEM2 concatenates the value for SEX to the value for NAME on every row. On the other hand, for ITEM1, only the desired text strings have been put next to the desired names.&lt;BR /&gt;
[pre]&lt;BR /&gt;
Inserting Text&lt;BR /&gt;
          &lt;BR /&gt;
            S&lt;BR /&gt;
            e&lt;BR /&gt;
  Name      x  item1                 item2                       Age     Height&lt;BR /&gt;
  Alfred    M  Alfred                M Alfred                     14         69&lt;BR /&gt;
  Alice     F  Alice                 F Alice                      13       56.5&lt;BR /&gt;
  Barbara   F  Barbara               F Barbara                    13       65.3&lt;BR /&gt;
  Carol     F  Carol                 F Carol                      14       62.8&lt;BR /&gt;
  Henry     M  Henry                 M Henry                      14       63.5&lt;BR /&gt;
  James     M  James                 M James                      12       57.3&lt;BR /&gt;
  Jane      F  An American: Jane     F Jane                       12       59.8&lt;BR /&gt;
  Janet     F  Janet                 F Janet                      15       62.5&lt;BR /&gt;
  Jeffrey   M  Jeffrey               M Jeffrey                    13       62.5&lt;BR /&gt;
  John      M  An Indian: John       M John                       12         59&lt;BR /&gt;
  Joyce     F  Joyce                 F Joyce                      11       51.3&lt;BR /&gt;
  Judy      F  Judy                  F Judy                       14       64.3&lt;BR /&gt;
  Louise    F  Louise                F Louise                     12       56.3&lt;BR /&gt;
  Mary      F  Mary                  F Mary                       15       66.5&lt;BR /&gt;
  Philip    M  Philip                M Philip                     16         72&lt;BR /&gt;
  Robert    M  Robert                M Robert                     12       64.8&lt;BR /&gt;
  Ronald    M  Ronald                M Ronald                     15         67&lt;BR /&gt;
  Thomas    M  Thomas                M Thomas                     11       57.5&lt;BR /&gt;
  William   M  William               M William                    15       66.5&lt;BR /&gt;
      &lt;BR /&gt;
[/pre]&lt;BR /&gt;
    &lt;BR /&gt;
For ITEM1, the compute block was:&lt;BR /&gt;
[pre]&lt;BR /&gt;
   compute item1 / character length=20;&lt;BR /&gt;
    if name='Jane' then&lt;BR /&gt;
       item1 = catx(' ','An American:',name);&lt;BR /&gt;
    else if name = 'John' then&lt;BR /&gt;
       item1 = catx(' ','An Indian:',name);&lt;BR /&gt;
    else &lt;BR /&gt;
       item1 = name;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
And, for ITEM2, the compute block was much simpler (although an IF statement could have been used in the compute block for item 2:&lt;BR /&gt;
[pre]&lt;BR /&gt;
  compute item2 / character length=20;&lt;BR /&gt;
       item2 = catx(' ',sex,name);&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
The column statement shows ITEM1 and ITEM2 after NAME and SEX: [pre]  column name sex item1 item2 age height ; [/pre] Of course, once you figure out which method is better for your report, then you can adjust the COLUMN statement accordingly.&lt;BR /&gt;
&lt;BR /&gt;
I did NOT use NOPRINT with NAME or SEX for this PROC REPORT step because I wanted to show how they were used in the creation of ITEM1 and ITEM2.&lt;BR /&gt;
 &lt;BR /&gt;
 cynthia</description>
      <pubDate>Tue, 25 Mar 2008 16:59:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7656#M2783</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-03-25T16:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert a text string at a particular observation</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7657#M2784</link>
      <description>Cynthia,&lt;BR /&gt;
&lt;BR /&gt;
I tried your suggestion with the following code:&lt;BR /&gt;
&lt;BR /&gt;
proc report nowindows data=sashelp.class;&lt;BR /&gt;
columns name sex item1 item2 age height weight;&lt;BR /&gt;
   compute item1 / character length=20;&lt;BR /&gt;
    if name='Jane' then&lt;BR /&gt;
       item1 = catx(' ','An American:',name);&lt;BR /&gt;
    else if name = 'John' then&lt;BR /&gt;
       item1 = catx(' ','An Indian:',name);&lt;BR /&gt;
    else &lt;BR /&gt;
       item1 = name;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute item2 / character length=20;&lt;BR /&gt;
       item2 = catx(' ',sex,name);&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
When I ran it (with SAS v9.1.3 SP4 under WinXpPro SP2), item1 was blanked out when name equaled Jane or John and the following note appeared in the log:&lt;BR /&gt;
&lt;BR /&gt;
WARNING: In a call to the CATX function, the buffer allocated for the result was not long enough to contain the&lt;BR /&gt;
         concatenation of all the arguments. The correct result would contain 17 characters, but the actual result&lt;BR /&gt;
         may either be truncated to 9 character(s) or be completely blank, depending on the calling environment.&lt;BR /&gt;
         The following note indicates the left-most argument that caused truncation.&lt;BR /&gt;
NOTE: Argument 2 to function CATX at line 1 column 30 is invalid.&lt;BR /&gt;
&lt;BR /&gt;
Increasing length to 30 didn't help.  &lt;BR /&gt;
&lt;BR /&gt;
Any ideas on how to get CATX to work in proc report? The if/else-if statements within the compute block code for item1 worked just fine in a datastep.&lt;BR /&gt;
&lt;BR /&gt;
Thanks.&lt;BR /&gt;
&lt;BR /&gt;
Jim</description>
      <pubDate>Tue, 25 Mar 2008 20:22:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7657#M2784</guid>
      <dc:creator>JimLoughlin</dc:creator>
      <dc:date>2008-03-25T20:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert a text string at a particular observation</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7658#M2785</link>
      <description>Hi Jim,&lt;BR /&gt;
  That is so totally weird. Here's my log. I didn't have that problem (as you can see) and I am running SAS 9.1.3, SP4 on an XP Pro box with Service Pack 2:&lt;BR /&gt;
[pre]&lt;BR /&gt;
80   ods listing;&lt;BR /&gt;
81   proc report data=sashelp.class nowd;&lt;BR /&gt;
82     title 'Inserting Text';&lt;BR /&gt;
83     column name sex item1 item2 age height ;&lt;BR /&gt;
84     define name / display;&lt;BR /&gt;
85     define sex / display;&lt;BR /&gt;
86     define item1 / computed;&lt;BR /&gt;
87     define item2 / computed;&lt;BR /&gt;
88     define age / display;&lt;BR /&gt;
89     define height /display;&lt;BR /&gt;
90&lt;BR /&gt;
91     compute item1 / character length=20;&lt;BR /&gt;
92       if name='Jane' then&lt;BR /&gt;
93          item1 = catx(' ','An American:',name);&lt;BR /&gt;
94       else if name = 'John' then&lt;BR /&gt;
95          item1 = catx(' ','An Indian:',name);&lt;BR /&gt;
96       else&lt;BR /&gt;
97          item1 = name;&lt;BR /&gt;
98     endcomp;&lt;BR /&gt;
99     compute item2 / character length=20;&lt;BR /&gt;
100         item2 = catx(' ',sex,name);&lt;BR /&gt;
101    endcomp;&lt;BR /&gt;
102&lt;BR /&gt;
103  run;&lt;BR /&gt;
   &lt;BR /&gt;
NOTE: There were 19 observations read from the data set SASHELP.CLASS.&lt;BR /&gt;
NOTE: PROCEDURE REPORT used (Total process time):&lt;BR /&gt;
      real time           1.04 seconds&lt;BR /&gt;
      cpu time            0.04 seconds&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
I suppose you could always fall back on the concatenate operator, as shown in Example 1 in this note: &lt;A href="http://support.sas.com/kb/24/514.html" target="_blank"&gt;http://support.sas.com/kb/24/514.html&lt;/A&gt;. But... I don't think it's CATX that's the issue.&lt;BR /&gt;
&lt;BR /&gt;
It troubles me that you're getting that warning message. I can duplicate the warning if I take out the DEFINE statements for ITEM1 and ITEM2. However, I don't recommend taking out the DEFINE statements for ITEM1 and ITEM2. &lt;BR /&gt;
&lt;BR /&gt;
I would never write a COMPUTE block for a COMPUTED variable and NOT have the DEFINE statements because the DEFINE statment links the computed report item with the compute block. In the absence of a DEFINE statement for ITEM1 and ITEM2, PROC REPORT probably expects that those report items are coming from the dataset and will assign them a default usage of DISPLAY, which they're not -- not DISPLAY, and not in the dataset. And not having a DEFINE statement with COMPUTED usage also seems to confuse PROC REPORT when it is setting up the buffer area for the report row.&lt;BR /&gt;
&lt;BR /&gt;
Did you leave out the DEFINE statements for ITEM1 and ITEM2 on purpose or did you just snip them from your posting???&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
 define item1 / computed;&lt;BR /&gt;
 define item2 / computed;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 If you left them out, then put them back in and see if the warning goes away. If you have them in the code and just didn't show them, then I think perhaps you need to contact Tech Support.&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 25 Mar 2008 21:38:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7658#M2785</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-03-25T21:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert a text string at a particular observation</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7659#M2786</link>
      <description>Cynthia,&lt;BR /&gt;
&lt;BR /&gt;
Putting the define statements in fixed the CATX issue.  Normally, I use define statements for all variables but was trying to keep the example simple and thereby unwittingly caused the problem.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again for your help.&lt;BR /&gt;
&lt;BR /&gt;
Jim</description>
      <pubDate>Tue, 25 Mar 2008 21:49:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7659#M2786</guid>
      <dc:creator>JimLoughlin</dc:creator>
      <dc:date>2008-03-25T21:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert a text string at a particular observation</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7660#M2787</link>
      <description>Hi Jim,&lt;BR /&gt;
  Glad that solved the problem. I probably should have posted the complete code. But I hoped that, having posted all 19 lines of the output, it would be OK to only post the COMPUTE blocks. My thinking was that someone who knew PROC REPORT would be able to construct the program that went with the COMPUTE blocks. &lt;BR /&gt;
&lt;BR /&gt;
  Keeping it simple only goes so far with PROC REPORT. Once you've signed up to the COMPUTE block, then you've also signed up for the DEFINE statement, too. &lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 25 Mar 2008 22:13:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7660#M2787</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-03-25T22:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert a text string at a particular observation</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7661#M2788</link>
      <description>Hi cynthia,&lt;BR /&gt;
thanks for reply and i don't want  to place 'An american'  before the 'Jane'  i want to place 'An american' above the 'Jane'  as shown below.&lt;BR /&gt;
&lt;BR /&gt;
James&lt;BR /&gt;
An American&lt;BR /&gt;
Jane&lt;BR /&gt;
Janett&lt;BR /&gt;
&lt;BR /&gt;
unlike An american:Jane and 'An american'  is a arbitrary.</description>
      <pubDate>Wed, 26 Mar 2008 04:24:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7661#M2788</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-03-26T04:24:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert a text string at a particular observation</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7662#M2789</link>
      <description>Hi:&lt;BR /&gt;
  I misunderstood how you used the word "before". When you said &lt;BR /&gt;
&lt;B&gt;&lt;BR /&gt;
"for example, i want to insert a string 'An American' before 'Jane' and a string 'An Indian' before 'John' ." &lt;/B&gt; &lt;BR /&gt;
...in your posting, you meant "above/before" and not "next to/before"??&lt;BR /&gt;
 &lt;BR /&gt;
It sounds like you want to stack the text string with the values in the cell. That means putting a LINE FEED character into the string. Not all destinations support the recognition of a LINE FEED character.  The mechanism for inserting a Line Feed or Line Break character is supported in ODS HTML, PDF and RTF -- but NOT in the LISTING destination. You'll have to run the code in order to see the ODS results.&lt;BR /&gt;
&lt;BR /&gt;
The ODS ESCAPECHAR statement&lt;BR /&gt;
[pre]&lt;BR /&gt;
  ODS ESCAPECHAR='#'; &lt;BR /&gt;
[/pre]&lt;BR /&gt;
defines a special character that can precede certain functions or instructions in order to change the report appearance in ODS destinations. For example, ESCAPECHAR + n is the LINE FEED or Carriage Return control string. ESCAPECHAR + S={attribute=value} is the STYLE override syntax. If the ESCAPECHAR is set to # (as shown above) then #n is the string for inserting a LINE FEED that is recognized by HTML, RTF and PDF. And, #S={foreground=yellow} will be the STYLE override to change the foreground color of the word "Computed" to yellow.&lt;BR /&gt;
&lt;BR /&gt;
Remember that ODS ESCAPECHAR and the STYLE syntax or the Line Feed syntax are NOT supported in the LISTING destination.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods listing;&lt;BR /&gt;
ods html file='c:\temp\linefeed.html' style=sasweb;&lt;BR /&gt;
ods pdf file='c:\temp\linefeed.pdf';&lt;BR /&gt;
ods rtf file='c:\temp\linefeed.rtf';&lt;BR /&gt;
    &lt;BR /&gt;
ods escapechar='#';&lt;BR /&gt;
     &lt;BR /&gt;
proc report data=sashelp.class nowd;&lt;BR /&gt;
  title 'Inserting Text and Changing Style';&lt;BR /&gt;
  column name sex &lt;BR /&gt;
         ('#S={foreground=yellow}Computed'item1 item2) &lt;BR /&gt;
          age height ;&lt;BR /&gt;
  define name / display;&lt;BR /&gt;
  define sex / display;&lt;BR /&gt;
  define item1 / computed;&lt;BR /&gt;
  define item2 / computed;&lt;BR /&gt;
  define age / display;&lt;BR /&gt;
  define height /display;&lt;BR /&gt;
     &lt;BR /&gt;
  compute item1 / character length=20;&lt;BR /&gt;
    if name='Jane' then&lt;BR /&gt;
       item1 = catx(' ','An American:#n',name);&lt;BR /&gt;
    else if name = 'John' then&lt;BR /&gt;
       item1 = catx(' ','An Indian:#n',name);&lt;BR /&gt;
    else &lt;BR /&gt;
       item1 = name;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute item2 / character length=20;&lt;BR /&gt;
       item2 = catx(' ',sex,'#n',name);&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
ods _all_ close;&lt;BR /&gt;
  &lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 26 Mar 2008 06:46:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7662#M2789</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-03-26T06:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert a text string at a particular observation</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7663#M2790</link>
      <description>Hi Cynthia,&lt;BR /&gt;
After executing the code that you provided,it puts 'An American' and 'Jane' in the same observation but i want them in  separate observations and also one skip after the observation that contains the vaue 'An American'.Can you please help me to solve this task.&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
      <pubDate>Wed, 26 Mar 2008 09:20:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7663#M2790</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-03-26T09:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert a text string at a particular observation</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7664#M2791</link>
      <description>Hi:&lt;BR /&gt;
  I have not explained PROC REPORT very well. &lt;B&gt;Proc Report is not creating "observations" it is writing report rows based on observations.&lt;/B&gt; The documentation contains a topic called "How PROC REPORT Builds a Report" which outlines this process step-by-step. It is a very useful explanation.&lt;BR /&gt;
 &lt;BR /&gt;
The report rows for a detail report do show you ALL the observations, but, PROC REPORT can only &lt;B&gt;display&lt;/B&gt; the observations that are in the DATA= data set. PROC REPORT can  "insert" extra/blank lines into the report -- but only at specific places, called break points (as described above in my first post). The break points where you can insert extra or blank lines are:&lt;BR /&gt;
1) at the top of the whole report or page for some destinations (COMPUTE BEFORE/COMPUTE BEFORE _PAGE_)&lt;BR /&gt;
2) at the bottom of the whole report or page for some destinations (COMPUTE AFTER/COMPUTE AFTER _PAGE_)&lt;BR /&gt;
3) at the top of a group of observations or at the top of a summary for a group of observations (COMPUTE BEFORE brkvar)&lt;BR /&gt;
4) at the bottom of a group of observations or at the bottom of a summary for a group of observations (COMPUTE AFTER brkvar)&lt;BR /&gt;
&lt;BR /&gt;
  In a detail report, on SASHELP.CLASS, the report row with "Jane" is NOT at a break point on the report, so there's no way to insert a line with text or a blank line into the report rows being built, using PROC REPORT. What I showed you -- putting the string "An American" into the same report cell on the report row with "Jane" is what you can do with PROC REPORT. (I've put a program at the bottom that illustrates exactly where you can insert lines into the report rows using PROC REPORT.)&lt;BR /&gt;
&lt;BR /&gt;
I'm still not sure I understand -exactly- what you want or why the insertion of arbitrary text is needed, but I think you have 2 choices --&lt;BR /&gt;
1)  Insert "new" observations into the data, you would would have to manipulate the data with a DATA STEP program and then pass the changed data to a report procedure (like PRINT or REPORT). &lt;BR /&gt;
2) Or, you could take control of report writing and use a DATA step program to write out report rows based on the observations in the input data set and the conditional logic you use in the program.&lt;BR /&gt;
&lt;BR /&gt;
At this point, we've gone back and forth several times and seem to be no closer to a solution for you. Perhaps the answer is PROC REPORT, perhaps the answer is data manipulation and inserting observations, perhaps the answer is a DATA _NULL_ report -- I think your best bet for help is to contact Tech Support. They can look at your data and your requirements and help you come up with the best solution.&lt;BR /&gt;
&lt;BR /&gt;
To send a question to Tech Support, go to &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt; and in the left-hand navigation pane, click on the link entitled "Submit a Problem".&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods listing;&lt;BR /&gt;
ods html file='c:\temp\shoes.html' style=sasweb;&lt;BR /&gt;
     &lt;BR /&gt;
proc report data=sashelp.shoes nowd;&lt;BR /&gt;
  column region product sales note;&lt;BR /&gt;
  where region in ('Asia', 'Canada');&lt;BR /&gt;
  define region /group;&lt;BR /&gt;
  define product / group;&lt;BR /&gt;
  define sales / sum;&lt;BR /&gt;
  define note /computed 'Manager Note';&lt;BR /&gt;
  break after region / summarize;&lt;BR /&gt;
  rbreak after / summarize;&lt;BR /&gt;
  compute note / character length=25;&lt;BR /&gt;
    if sales.sum lt 10000 then&lt;BR /&gt;
       note = 'Discontinue Item???';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute before _page_;&lt;BR /&gt;
    line 'COMPUTE BEFORE _PAGE_';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute before;&lt;BR /&gt;
    line 'COMPUTE BEFORE';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute before region;&lt;BR /&gt;
    line 'COMPUTE BEFORE REGION';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute after region;&lt;BR /&gt;
    region = 'SubTotal';&lt;BR /&gt;
    line 'COMPUTE AFTER REGION';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute after;&lt;BR /&gt;
    region = 'Total';&lt;BR /&gt;
    line 'COMPUTE AFTER';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute after _page_;&lt;BR /&gt;
    line 'COMPUTE AFTER _PAGE_';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 27 Mar 2008 15:09:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7664#M2791</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-03-27T15:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert a text string at a particular observation</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7665#M2792</link>
      <description>Hi cynthia,&lt;BR /&gt;
In data manipulation i am getting my desired result,i  posted the forum just to know whether it is possible by using PROC REPORT ot not.From your reply i came to know that it is not possible by PROC REPORT .&lt;BR /&gt;
&lt;BR /&gt;
Thank you very much for your kind respose.</description>
      <pubDate>Fri, 28 Mar 2008 08:44:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-insert-a-text-string-at-a-particular-observation/m-p/7665#M2792</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-03-28T08:44:02Z</dc:date>
    </item>
  </channel>
</rss>

