<?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: Concatenate Variables  in proc report in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenate-Variables-in-proc-report/m-p/17527#M3559</link>
    <description>Hi:&lt;BR /&gt;
  I'm confused...what do you want to CREATE??? NAME, XBB or XCC??? I am guessing that you are getting a message like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
NOTE: Invalid numeric data, 'XXXYYY' , at line 1 column 12.&lt;BR /&gt;
[/pre]&lt;BR /&gt;
  &lt;BR /&gt;
someplace in your log???&lt;BR /&gt;
&lt;BR /&gt;
When you want/need to compute a character variable, you have to tell PROC REPORT -- normally, it wants computed variables to be numeric. The way you tell PROC REPORT is in the COMPUTE block:&lt;BR /&gt;
[pre]&lt;BR /&gt;
COMPUTE NAME / CHARACTER length=8;&lt;BR /&gt;
  NAME = trim(xc)||' '||trim(xb);&lt;BR /&gt;
ENDCOMP;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
   &lt;BR /&gt;
Do note that the length specified should be equal to the longest value for XC plus the longest value for XB plus 1 for the space in between -- I just picked 8 arbitrarily because of your test data -- but your real data may be longer. &lt;BR /&gt;
&lt;BR /&gt;
Also, you have XBB and XCC in DEFINE Statements, but not in the COLUMN statement -- this should be showing you this warning in the LOG:&lt;BR /&gt;
[pre]&lt;BR /&gt;
WARNING: xbb is not in the report definition.&lt;BR /&gt;
WARNING: xcc is not in the report definition.&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                      &lt;BR /&gt;
and the fix for this is to put these 2 computed items in the COLUMN statement or remove the DEFINE statements if you don't need them once you get NAME working.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
&lt;BR /&gt;
ps...or you can concatenate the variables ahead of time in a DATA step program.</description>
    <pubDate>Fri, 25 Feb 2011 16:13:13 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2011-02-25T16:13:13Z</dc:date>
    <item>
      <title>Concatenate Variables  in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenate-Variables-in-proc-report/m-p/17525#M3557</link>
      <description>Guys,&lt;BR /&gt;
Is it possible for a computed variable in proc report to have the concatenated values of two other variables.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
DATA A;&lt;BR /&gt;
XC='XXX';&lt;BR /&gt;
XB='YYY';&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
PROC REPORT DATA=A;&lt;BR /&gt;
COLUMN XC XB NAME;&lt;BR /&gt;
DEFINE XC / DISPLAY;&lt;BR /&gt;
DEFINE XB / DISPLAY;&lt;BR /&gt;
define xcc / computed;&lt;BR /&gt;
define xbb / computed;&lt;BR /&gt;
DEFINE NAME / COMPUTED;&lt;BR /&gt;
&lt;BR /&gt;
COMPUTE NAME;&lt;BR /&gt;
NAME = XC || XB;&lt;BR /&gt;
ENDCOMP;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
What i am looking for is that my vaible NAME should be "XXX YYY". in the report.&lt;BR /&gt;
&lt;BR /&gt;
PLZ suggest</description>
      <pubDate>Fri, 25 Feb 2011 09:00:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenate-Variables-in-proc-report/m-p/17525#M3557</guid>
      <dc:creator>NN</dc:creator>
      <dc:date>2011-02-25T09:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate Variables  in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenate-Variables-in-proc-report/m-p/17526#M3558</link>
      <description>I had the same problem. &lt;BR /&gt;
&lt;BR /&gt;
Just make a variable in your data set A which concats the two, and display that var?</description>
      <pubDate>Fri, 25 Feb 2011 10:01:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenate-Variables-in-proc-report/m-p/17526#M3558</guid>
      <dc:creator>Filipvdr</dc:creator>
      <dc:date>2011-02-25T10:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate Variables  in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenate-Variables-in-proc-report/m-p/17527#M3559</link>
      <description>Hi:&lt;BR /&gt;
  I'm confused...what do you want to CREATE??? NAME, XBB or XCC??? I am guessing that you are getting a message like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
NOTE: Invalid numeric data, 'XXXYYY' , at line 1 column 12.&lt;BR /&gt;
[/pre]&lt;BR /&gt;
  &lt;BR /&gt;
someplace in your log???&lt;BR /&gt;
&lt;BR /&gt;
When you want/need to compute a character variable, you have to tell PROC REPORT -- normally, it wants computed variables to be numeric. The way you tell PROC REPORT is in the COMPUTE block:&lt;BR /&gt;
[pre]&lt;BR /&gt;
COMPUTE NAME / CHARACTER length=8;&lt;BR /&gt;
  NAME = trim(xc)||' '||trim(xb);&lt;BR /&gt;
ENDCOMP;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
   &lt;BR /&gt;
Do note that the length specified should be equal to the longest value for XC plus the longest value for XB plus 1 for the space in between -- I just picked 8 arbitrarily because of your test data -- but your real data may be longer. &lt;BR /&gt;
&lt;BR /&gt;
Also, you have XBB and XCC in DEFINE Statements, but not in the COLUMN statement -- this should be showing you this warning in the LOG:&lt;BR /&gt;
[pre]&lt;BR /&gt;
WARNING: xbb is not in the report definition.&lt;BR /&gt;
WARNING: xcc is not in the report definition.&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                      &lt;BR /&gt;
and the fix for this is to put these 2 computed items in the COLUMN statement or remove the DEFINE statements if you don't need them once you get NAME working.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
&lt;BR /&gt;
ps...or you can concatenate the variables ahead of time in a DATA step program.</description>
      <pubDate>Fri, 25 Feb 2011 16:13:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenate-Variables-in-proc-report/m-p/17527#M3559</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-02-25T16:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate Variables  in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenate-Variables-in-proc-report/m-p/17528#M3560</link>
      <description>OK. It is easy.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods pdf file='c:\test.pdf' style=journal;&lt;BR /&gt;
proc report data=sashelp.class nowd ;&lt;BR /&gt;
 column name sex weight merge;&lt;BR /&gt;
 define name /'Name';&lt;BR /&gt;
 define sex /'Sex' ;&lt;BR /&gt;
 define merge/'Name and Sex' computed;&lt;BR /&gt;
 compute merge / character length=100;&lt;BR /&gt;
  merge=cats(name,sex);&lt;BR /&gt;
 endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
ods pdf close;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp

Message was edited by: Ksharp</description>
      <pubDate>Mon, 28 Feb 2011 08:30:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenate-Variables-in-proc-report/m-p/17528#M3560</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-02-28T08:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate Variables  in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenate-Variables-in-proc-report/m-p/615819#M23661</link>
      <description>&lt;P&gt;Doing something similar but wondering if it's possible to retain the formatting of the columns that you're concatenating so I can have the make with standard formatting the type remain italic as they are when in their own column?&amp;nbsp; As an example I've used the cars data set to illustrate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data cars;&lt;BR /&gt;set sashelp.cars;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc freq data=cars;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; table make*type/list out=c1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ods escape char="~";&lt;BR /&gt;proc report data=c1 split='^' style=journal;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;column make type final count;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;define make /display left 'Make' style(column)=[width=10%] ;&lt;BR /&gt;define type /left display 'Type' style(column)=[width=10% font_style=italic];&lt;BR /&gt;&amp;nbsp;&amp;nbsp; define final /computed left 'Make, ~S={font_style=italic}Type' style(column)=[width=10%] ;&lt;BR /&gt;define count/center display "M(SD) ^ or N(%)" style(column)=[width=10%];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;compute final /character length=95;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; final=cat(trim(make),", ",left(trim(type)));&lt;BR /&gt;endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2020 21:54:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Concatenate-Variables-in-proc-report/m-p/615819#M23661</guid>
      <dc:creator>Rae_</dc:creator>
      <dc:date>2020-01-07T21:54:08Z</dc:date>
    </item>
  </channel>
</rss>

