<?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 Creating a character variable using Proc Report in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-character-variable-using-Proc-Report/m-p/332669#M62783</link>
    <description>&lt;P&gt;&lt;FONT color="#000000" face="times new roman,times" size="3"&gt;Hello, &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="3"&gt;&lt;FONT color="#000000"&gt;Is it possible to compute/create a character variable in proc report? What I would like to do is take 2 numbers, a create a new character variable that puts them in a from that looks something like this: (18.2, 21.1). However, it seems that maybe compute blocks can only create numeric variables. Is there a way around this?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="times new roman,times" size="3"&gt;Thanks!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;surveyfreq&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=d1&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;tables&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; walk / &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;row&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;cl&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;nowt&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;nostd&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;stratum&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; final_stratum;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;cluster&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; final_cluster;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;weight&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; final_weight;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;ods&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;output&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; oneway=out_table;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;report&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=out_table;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;columns&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; table percent lowerCL UpperCL CL;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; table / &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;display&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; percent / &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;display&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; lowerCL / &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;display&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; UpperCL / &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;display&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; CL / &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;computed&lt;/FONT&gt; &lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;compute&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; CL; CL = cats(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"("&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;, LowerCL, &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;","&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;, UpperCL, &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;")"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;); &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;ENDCOMP&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Error message:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Character values have been converted to numeric values at the places given by:&lt;/P&gt;&lt;P&gt;(Line):(Column).&lt;/P&gt;&lt;P&gt;1:7&lt;/P&gt;&lt;P&gt;NOTE: Invalid numeric data, '(78.900921457,81.793697714)' , at line 1 column 7.&lt;/P&gt;&lt;P&gt;NOTE: Invalid numeric data, '(18.206302286,21.099078543)' , at line 1 column 7.&lt;/P&gt;&lt;P&gt;NOTE: Invalid numeric data, '(_,_)' , at line 1 column 7.&lt;/P&gt;&lt;P&gt;NOTE: There were 3 observations read from the data set WORK.out_table.&lt;/P&gt;&lt;P&gt;NOTE: At least one W.D format was too small for the number to be printed. The decimal may be&lt;/P&gt;&lt;P&gt;shifted by the "BEST" format.&lt;/P&gt;</description>
    <pubDate>Tue, 14 Feb 2017 15:44:48 GMT</pubDate>
    <dc:creator>Noob</dc:creator>
    <dc:date>2017-02-14T15:44:48Z</dc:date>
    <item>
      <title>Creating a character variable using Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-character-variable-using-Proc-Report/m-p/332669#M62783</link>
      <description>&lt;P&gt;&lt;FONT color="#000000" face="times new roman,times" size="3"&gt;Hello, &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="3"&gt;&lt;FONT color="#000000"&gt;Is it possible to compute/create a character variable in proc report? What I would like to do is take 2 numbers, a create a new character variable that puts them in a from that looks something like this: (18.2, 21.1). However, it seems that maybe compute blocks can only create numeric variables. Is there a way around this?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="times new roman,times" size="3"&gt;Thanks!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;surveyfreq&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=d1&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;tables&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; walk / &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;row&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;cl&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;nowt&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;nostd&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;stratum&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; final_stratum;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;cluster&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; final_cluster;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;weight&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; final_weight;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;ods&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;output&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; oneway=out_table;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;report&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=out_table;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;columns&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; table percent lowerCL UpperCL CL;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; table / &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;display&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; percent / &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;display&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; lowerCL / &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;display&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; UpperCL / &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;display&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; CL / &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;computed&lt;/FONT&gt; &lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;compute&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; CL; CL = cats(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"("&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;, LowerCL, &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;","&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;, UpperCL, &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;")"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;); &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;ENDCOMP&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Error message:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Character values have been converted to numeric values at the places given by:&lt;/P&gt;&lt;P&gt;(Line):(Column).&lt;/P&gt;&lt;P&gt;1:7&lt;/P&gt;&lt;P&gt;NOTE: Invalid numeric data, '(78.900921457,81.793697714)' , at line 1 column 7.&lt;/P&gt;&lt;P&gt;NOTE: Invalid numeric data, '(18.206302286,21.099078543)' , at line 1 column 7.&lt;/P&gt;&lt;P&gt;NOTE: Invalid numeric data, '(_,_)' , at line 1 column 7.&lt;/P&gt;&lt;P&gt;NOTE: There were 3 observations read from the data set WORK.out_table.&lt;/P&gt;&lt;P&gt;NOTE: At least one W.D format was too small for the number to be printed. The decimal may be&lt;/P&gt;&lt;P&gt;shifted by the "BEST" format.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 15:44:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-a-character-variable-using-Proc-Report/m-p/332669#M62783</guid>
      <dc:creator>Noob</dc:creator>
      <dc:date>2017-02-14T15:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a character variable using Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-character-variable-using-Proc-Report/m-p/332675#M62784</link>
      <description>&lt;P&gt;Since you are not actually calculating the values for the limits in the proc report I would think the easier way would be in an intermediate datastep;&lt;/P&gt;
&lt;PRE&gt;data out_table;
   set out_table;
   CL = cats("(", LowerCL, ",", UpperCL, ")"); 
run;&lt;/PRE&gt;
&lt;P&gt;before the Proc report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would probably use a Put(lowercl,best6.) or similar in the cats function unless you really think the additional digits are helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know of a method that involves custom format to supply leading (, leading comma with trailing ) , style justifications of right and left for adjacent columns, reducing the cellpadding and border widths to 0 to get that appearance in calculated columns&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 15:56:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-a-character-variable-using-Proc-Report/m-p/332675#M62784</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-14T15:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a character variable using Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-character-variable-using-Proc-Report/m-p/332710#M62785</link>
      <description>Hi, &lt;BR /&gt;Yes, you can calculate a character variable in a COMPUTE block, but you have to tell the COMPUTE block that it is character. The default is numeric. So instead of this:&lt;BR /&gt;compute CL; &lt;BR /&gt;   CL = cats("(", LowerCL, ",", UpperCL, ")"); &lt;BR /&gt;ENDCOMP;&lt;BR /&gt;&lt;BR /&gt;use this:&lt;BR /&gt;compute CL / character length=20; &lt;BR /&gt;   CL = cats("(", LowerCL, ",", UpperCL, ")"); &lt;BR /&gt;ENDCOMP;&lt;BR /&gt;&lt;BR /&gt;cynthia</description>
      <pubDate>Tue, 14 Feb 2017 16:56:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-a-character-variable-using-Proc-Report/m-p/332710#M62785</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-02-14T16:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a character variable using Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-character-variable-using-Proc-Report/m-p/332728#M62786</link>
      <description>&lt;P&gt;Thank you both for your helpful replies!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 17:33:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-a-character-variable-using-Proc-Report/m-p/332728#M62786</guid>
      <dc:creator>Noob</dc:creator>
      <dc:date>2017-02-14T17:33:20Z</dc:date>
    </item>
  </channel>
</rss>

