<?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 write a code in this situation. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496759#M131465</link>
    <description>&lt;P&gt;I'm going to echo the suggestion that the source of this question may be not the most reliable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Are you doing an exercise to learn to create new variables or how to create clinical reports?&lt;/P&gt;
&lt;P&gt;If it's the latter, I recommend following Cynthia Zenders' Create Complex Reports document and the code that goes along with it. You can work through the examples and then decide how to create your reports.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Sep 2018 21:52:27 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-09-18T21:52:27Z</dc:date>
    <item>
      <title>How to write a code in this situation.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496736#M131445</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1111.JPG" style="width: 485px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23362iCCA849AC91CA49B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="1111.JPG" alt="1111.JPG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="11111.JPG" style="width: 467px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23361i157699A824A4D44E/image-size/large?v=v2&amp;amp;px=999" role="button" title="11111.JPG" alt="11111.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 20:44:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496736#M131445</guid>
      <dc:creator>shaher</dc:creator>
      <dc:date>2018-09-18T20:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a code in this situation.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496741#M131449</link>
      <description>&lt;P&gt;What's the question for us?&lt;/P&gt;
&lt;P&gt;What have you tried? What works, what doesn't?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;To answer your question I'd have to type out the data, at minimum, providing that would be helpful for anyone who did want to help you out with this question. Don't post data or code as images.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/232019"&gt;@shaher&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1111.JPG" style="width: 485px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23362iCCA849AC91CA49B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="1111.JPG" alt="1111.JPG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="11111.JPG" style="width: 467px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23361i157699A824A4D44E/image-size/large?v=v2&amp;amp;px=999" role="button" title="11111.JPG" alt="11111.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 20:56:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496741#M131449</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-18T20:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a code in this situation.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496744#M131452</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to find a code to create a new character variable.&amp;nbsp; by using trim function.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 21:00:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496744#M131452</guid>
      <dc:creator>shaher</dc:creator>
      <dc:date>2018-09-18T21:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a code in this situation.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496750#M131457</link>
      <description>&lt;P&gt;You have numeric values that need to be converted to character, to make them part of the new variable.&amp;nbsp; As a result, it's easier to forget about TRIM and use CATT instead:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;length newvar $ 20;&lt;/P&gt;
&lt;P&gt;if datatype='numeric' then newvar = catt(stat1, ' (' , stat2, ')' );&lt;/P&gt;
&lt;P&gt;else newvar = catt(stat1, ' (', stat2, '%)' );&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 21:10:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496750#M131457</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-09-18T21:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a code in this situation.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496751#M131458</link>
      <description>&lt;P&gt;A character variable named myVar&amp;nbsp;is created as soon as you say&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;myVar = "Some string";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 21:11:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496751#M131458</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-09-18T21:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a code in this situation.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496756#M131463</link>
      <description>&lt;P&gt;Considering that the vartype is misspelled for the 4th record I would be very careful using their example data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also anytime a variable changes meanings like that, stat1 is sometimes mean and sometimes count, then someone is providing poor data models to follow...&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 21:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496756#M131463</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-18T21:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a code in this situation.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496759#M131465</link>
      <description>&lt;P&gt;I'm going to echo the suggestion that the source of this question may be not the most reliable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Are you doing an exercise to learn to create new variables or how to create clinical reports?&lt;/P&gt;
&lt;P&gt;If it's the latter, I recommend following Cynthia Zenders' Create Complex Reports document and the code that goes along with it. You can work through the examples and then decide how to create your reports.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 21:52:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496759#M131465</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-18T21:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a code in this situation.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496766#M131469</link>
      <description>&lt;P&gt;I use it but not working&amp;nbsp;&lt;/P&gt;&lt;P&gt;length newvar $ 20;&lt;/P&gt;&lt;P&gt;if vartype ='numeric' then newvar = catt(stat1, ' (' , stat2, ')' );&lt;/P&gt;&lt;P&gt;else newvar = catt(stat1, ' (', stat2, '%)' );&lt;BR /&gt;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=HW4q2p1;&lt;BR /&gt;var vartype $char9. newvar $ 20;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;-----------------&lt;/P&gt;&lt;P&gt;The SAS System 17:54 Tuesday, September 18, 2018 6&lt;/P&gt;&lt;P&gt;Obs vartype stat1 stat2&lt;/P&gt;&lt;P&gt;1 numeric 25.5 12.7&lt;BR /&gt;2 character 36.0 34.4&lt;BR /&gt;3 numeric 150.0 124.0&lt;BR /&gt;4 charecter 23.0 12.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is my friend result but I don't&amp;nbsp;how to get it&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="file-1 (1).jpeg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23363iBAE97E4A67B1B851/image-size/large?v=v2&amp;amp;px=999" role="button" title="file-1 (1).jpeg" alt="file-1 (1).jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 22:08:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496766#M131469</guid>
      <dc:creator>shaher</dc:creator>
      <dc:date>2018-09-18T22:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a code in this situation.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496769#M131472</link>
      <description>&lt;P&gt;Is that your full code? Where's the&amp;nbsp;DATA step statement?&lt;/P&gt;
&lt;P&gt;Paste the full code. The code suggested would need to be embedded within a data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/232019"&gt;@shaher&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I use it but not working&amp;nbsp;&lt;/P&gt;
&lt;P&gt;length newvar $ 20;&lt;/P&gt;
&lt;P&gt;if vartype ='numeric' then newvar = catt(stat1, ' (' , stat2, ')' );&lt;/P&gt;
&lt;P&gt;else newvar = catt(stat1, ' (', stat2, '%)' );&lt;BR /&gt;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=HW4q2p1;&lt;BR /&gt;var vartype $char9. newvar $ 20;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;-----------------&lt;/P&gt;
&lt;P&gt;The SAS System 17:54 Tuesday, September 18, 2018 6&lt;/P&gt;
&lt;P&gt;Obs vartype stat1 stat2&lt;/P&gt;
&lt;P&gt;1 numeric 25.5 12.7&lt;BR /&gt;2 character 36.0 34.4&lt;BR /&gt;3 numeric 150.0 124.0&lt;BR /&gt;4 charecter 23.0 12.1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this is my friend result but I don't&amp;nbsp;how to get it&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="file-1 (1).jpeg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23363iBAE97E4A67B1B851/image-size/large?v=v2&amp;amp;px=999" role="button" title="file-1 (1).jpeg" alt="file-1 (1).jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 22:10:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496769#M131472</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-18T22:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a code in this situation.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496776#M131475</link>
      <description>data aaa;&lt;BR /&gt;input vartype $char9. stat1 stat2;&lt;BR /&gt;datalines;&lt;BR /&gt;numeric 25.5 12.7&lt;BR /&gt;character 36 34.4&lt;BR /&gt;numeric 150 124&lt;BR /&gt;charecter 23 12.1&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=HW4q2; run;&lt;BR /&gt;data bbb;&lt;BR /&gt;set aaa;&lt;BR /&gt;length newvar $ 20;&lt;BR /&gt;&lt;BR /&gt;if vartype ='numeric' then newvar = catt(stat1, ' (' , stat2, ')' );&lt;BR /&gt;&lt;BR /&gt;else newvar = catt(stat1, ' (', stat2, '%)' );&lt;BR /&gt;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=bbb;&lt;BR /&gt;var vartype $char9. newvar $ 20;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;this is the full code</description>
      <pubDate>Tue, 18 Sep 2018 22:23:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496776#M131475</guid>
      <dc:creator>shaher</dc:creator>
      <dc:date>2018-09-18T22:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a code in this situation.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496777#M131476</link>
      <description>&lt;P&gt;Same answer as via private message. Read the log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It works, your PROC PRINT is wrong. The VAR statement does not support formats and the error pretty much tells you that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ALWAYS READ THE LOG.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/232019"&gt;@shaher&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;data aaa;&lt;BR /&gt;input vartype $char9. stat1 stat2;&lt;BR /&gt;datalines;&lt;BR /&gt;numeric 25.5 12.7&lt;BR /&gt;character 36 34.4&lt;BR /&gt;numeric 150 124&lt;BR /&gt;charecter 23 12.1&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=HW4q2; run;&lt;BR /&gt;data bbb;&lt;BR /&gt;set aaa;&lt;BR /&gt;length newvar $ 20;&lt;BR /&gt;&lt;BR /&gt;if vartype ='numeric' then newvar = catt(stat1, ' (' , stat2, ')' );&lt;BR /&gt;&lt;BR /&gt;else newvar = catt(stat1, ' (', stat2, '%)' );&lt;BR /&gt;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=bbb;&lt;BR /&gt;var vartype $char9. newvar $ 20;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;this is the full code&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 22:31:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496777#M131476</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-18T22:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a code in this situation.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496782#M131478</link>
      <description>You should mark someone else's answer as correct, someone who helped with the actual code.</description>
      <pubDate>Tue, 18 Sep 2018 22:39:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-a-code-in-this-situation/m-p/496782#M131478</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-18T22:39:43Z</dc:date>
    </item>
  </channel>
</rss>

