<?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 Replacing variables by their formatted values....? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Replacing-variables-by-their-formatted-values/m-p/105469#M258488</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I am not mistaken the formatted values are only displayed in SAS outputs.&lt;/P&gt;&lt;P&gt;Suppose I have a data set , one of the variables is STATE (State names) I have created a format to to display the state names in their abbriviated form.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to alter this data set permanently by replacing the state names by their abbr. names.&lt;/P&gt;&lt;P&gt;My thoughts ....to save the print out put as a new data set....not sure how I can do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions!!&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Raghu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Dec 2012 16:08:23 GMT</pubDate>
    <dc:creator>rnmishra</dc:creator>
    <dc:date>2012-12-20T16:08:23Z</dc:date>
    <item>
      <title>Replacing variables by their formatted values....?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-variables-by-their-formatted-values/m-p/105469#M258488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I am not mistaken the formatted values are only displayed in SAS outputs.&lt;/P&gt;&lt;P&gt;Suppose I have a data set , one of the variables is STATE (State names) I have created a format to to display the state names in their abbriviated form.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to alter this data set permanently by replacing the state names by their abbr. names.&lt;/P&gt;&lt;P&gt;My thoughts ....to save the print out put as a new data set....not sure how I can do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions!!&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Raghu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Dec 2012 16:08:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-variables-by-their-formatted-values/m-p/105469#M258488</guid>
      <dc:creator>rnmishra</dc:creator>
      <dc:date>2012-12-20T16:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing variables by their formatted values....?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-variables-by-their-formatted-values/m-p/105470#M258489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First why do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second, you can apply a format in a data step and create a new variable.&lt;/P&gt;&lt;P&gt;*character;&lt;/P&gt;&lt;P&gt;state_format=putc(state, $state_fmt.);&lt;/P&gt;&lt;P&gt;*Number;&lt;/P&gt;&lt;P&gt;state_format=putn(state, state_fmt.);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Dec 2012 16:11:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-variables-by-their-formatted-values/m-p/105470#M258489</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-12-20T16:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing variables by their formatted values....?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-variables-by-their-formatted-values/m-p/105471#M258490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't test this at the moment but in earlier versions of SAS the second parameter of putc() and putn() had to be character expressions, ie the name of the format enclosed in quotes.&amp;nbsp; Maybe SAS now automatically manages the conversion.&amp;nbsp; The syntax shown is correct for the put() function in both cases.&lt;/P&gt;&lt;P&gt;You can put the abbreviation back into the state column if it is also a character variable:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; state=put(state, $state_fmt.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;However, the length of the state variable will be unchanged (and longer than the abbreviation).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Richard&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Dec 2012 23:03:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-variables-by-their-formatted-values/m-p/105471#M258490</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2012-12-20T23:03:36Z</dc:date>
    </item>
  </channel>
</rss>

