<?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: Why us the put function on a character variable? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Why-us-the-put-function-on-a-character-variable/m-p/170909#M44155</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sometimes the answer turns out to be, "They didn't know any better."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would make a little sense if they used INPUT instead of PUT (and 2. instead of $2.).&amp;nbsp; That would eliminate messages about character to numeric conversion on the log when computing newsn.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Nov 2014 02:34:36 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2014-11-14T02:34:36Z</dc:date>
    <item>
      <title>Why us the put function on a character variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-us-the-put-function-on-a-character-variable/m-p/170906#M44152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I've seen code in programs where I work where people create a character variable from another character variable using the put function.&amp;nbsp; What's the point?&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;I know here that they are trying to add 50 to the positions 12:13 inside the character variable hrlongid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;length serial $2;&lt;/P&gt;&lt;P&gt;length newsn 8;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;serial=put(substr(hrlongid,12,2),$2.);&lt;/P&gt;&lt;P&gt;newsn=serial+50;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;substr(hrlongid,12,2)=newsn;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wouldn't the last statement have to replace positions 12:13 with another character variable?&lt;/P&gt;&lt;P&gt;Why can't serial just be substr(hrlongid,12,2)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 22:01:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-us-the-put-function-on-a-character-variable/m-p/170906#M44152</guid>
      <dc:creator>susigaj</dc:creator>
      <dc:date>2014-11-13T22:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Why us the put function on a character variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-us-the-put-function-on-a-character-variable/m-p/170907#M44153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;seems abundant to me. if they don't have length statement: "length serial $2;", then there is a difference:&lt;/P&gt;&lt;P&gt;with just substr(), the new variable will inherit the same length as the source variable, with put(substr(), $2.) structure, the new var will get the length defined in the informat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 22:35:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-us-the-put-function-on-a-character-variable/m-p/170907#M44153</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-11-13T22:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: Why us the put function on a character variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-us-the-put-function-on-a-character-variable/m-p/170908#M44154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;While that may not be the most useful version of Putting a character variable consider:&lt;/P&gt;&lt;P&gt;You have code such as a stock ticker symbol: XYZ and you are combining it with boiler plate text and other variable to create a sentence like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XYZ had an earnings (increase/decrease) of (value) dollars of the past (interval text).&lt;/P&gt;&lt;P&gt;XYZ could be Put using a custom format for this sentence to read&lt;/P&gt;&lt;P&gt;Alpha Beta Manufacturing, Inc. had ...&lt;/P&gt;&lt;P&gt;Also with a different format the same symbol could use a shorter version such as Alpha Beta, or a much longer piece of text. Not to mention yet another format that would place it into a category:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This placed &amp;lt;company name&amp;gt; among the &amp;lt;top/bottom&amp;gt; 3 companies in &amp;lt;industry type&amp;gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 22:53:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-us-the-put-function-on-a-character-variable/m-p/170908#M44154</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-11-13T22:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Why us the put function on a character variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-us-the-put-function-on-a-character-variable/m-p/170909#M44155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sometimes the answer turns out to be, "They didn't know any better."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would make a little sense if they used INPUT instead of PUT (and 2. instead of $2.).&amp;nbsp; That would eliminate messages about character to numeric conversion on the log when computing newsn.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 02:34:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-us-the-put-function-on-a-character-variable/m-p/170909#M44155</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2014-11-14T02:34:36Z</dc:date>
    </item>
  </channel>
</rss>

