<?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: put in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/put/m-p/800460#M314895</link>
    <description>&lt;P&gt;What part is confusing you? What result are you expecting?&lt;/P&gt;</description>
    <pubDate>Sun, 06 Mar 2022 12:09:41 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-03-06T12:09:41Z</dc:date>
    <item>
      <title>put</title>
      <link>https://communities.sas.com/t5/SAS-Programming/put/m-p/800459#M314894</link>
      <description>&lt;PRE&gt;data one;                                                                                                                               
   cc='abc';                                                                                                                              
   cchex=put(cc,hex4.);                                                                                                                   
   put cc= hex4.;                                                                                                                         
                                                                                                                                        
/* If you need to keep the original variable name of cc, but as a character variable,                                                  
    then use the DROP and RENAME statements following the PUT function.  */                                                             
                                                                                                                                        
   cchex=put(cc,hex4.);                                                                                                                   
   drop cc;                                                                                                                               
   rename cchex=cc;                                                                                                                       
   put cc=;                                                                                                                               
run;&lt;/PRE&gt;&lt;P&gt;I read this from the doc trying to understand how to use put but get more confused, what is it doing ?&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 12:00:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/put/m-p/800459#M314894</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-03-06T12:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: put</title>
      <link>https://communities.sas.com/t5/SAS-Programming/put/m-p/800460#M314895</link>
      <description>&lt;P&gt;What part is confusing you? What result are you expecting?&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 12:09:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/put/m-p/800460#M314895</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-06T12:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: put</title>
      <link>https://communities.sas.com/t5/SAS-Programming/put/m-p/800461#M314896</link>
      <description>&lt;P&gt;The PUT Statement is writing the variable value to the output destination. If you don't specify it specifically via a FILE statement then it's writing to the SAS Log.&lt;/P&gt;
&lt;P&gt;PUT &amp;lt;variable name&amp;gt;=; will also write the variable name to the output destination - &amp;lt;variable name&amp;gt;= &amp;lt;value&amp;gt;;&lt;/P&gt;
&lt;P&gt;PUT &amp;lt;variable name&amp;gt;= &amp;lt;SAS format&amp;gt;; will write the value formatted. In your sample code as HEX value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The PUT Function gets always used in conjunction with a SAS Format. It returns the formatted value that then gets assigned to the variable on the left side of the equal sign.&lt;/P&gt;
&lt;P&gt;&amp;lt;new variable&amp;gt;=put(&amp;lt;variable&amp;gt;,&amp;lt;SAS format&amp;gt;);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;More about the PUT Statement and the PUT Function in the SAS Documentation.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 12:25:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/put/m-p/800461#M314896</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-03-06T12:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: put</title>
      <link>https://communities.sas.com/t5/SAS-Programming/put/m-p/800478#M314913</link>
      <description>&lt;P&gt;So you create a character variable named CC that is three bytes long.&lt;/P&gt;
&lt;P&gt;Then you used the PUT() function to convert the first two bytes of that variable into the 4 byte hexadecimal representation of those two bytes and used it to create a new variable CCHEX which will be 4 bytes long.&lt;/P&gt;
&lt;P&gt;Then you wrote the value of the first two bytes of CC to the log, again using the 4 character hex code.&amp;nbsp; The value written to the log will be prefixed with the name of the variable and an equal sign.&lt;/P&gt;
&lt;P&gt;You then re-wrote the same value into the variable CCHEX by repeating the same code as before.&lt;/P&gt;
&lt;P&gt;The next two statements just control how the dataset ONE is created.&amp;nbsp; The three byte variable CC with is not written.&amp;nbsp; But the four byte variable CCHEX is written but it will be called CC, not CCHEX.&lt;/P&gt;
&lt;P&gt;You then write the value of CC to the log, this time you write the whole value and do not convert it to hexadecimal codes.&amp;nbsp; Again the value is prefixed with the name of the variable and an equal sign.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 16:43:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/put/m-p/800478#M314913</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-03-06T16:43:36Z</dc:date>
    </item>
  </channel>
</rss>

