<?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 Add Suffix to all variables in dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43587#M8933</link>
    <description>I'm looking for a fast way to do this.  I need to add the following to the end of all variables in the dataset:&lt;BR /&gt;
&lt;BR /&gt;
"_3mo"&lt;BR /&gt;
&lt;BR /&gt;
so that&lt;BR /&gt;
&lt;BR /&gt;
ID = ID_3mo&lt;BR /&gt;
&lt;BR /&gt;
Thanks!</description>
    <pubDate>Wed, 20 Jan 2010 20:20:22 GMT</pubDate>
    <dc:creator>statadm</dc:creator>
    <dc:date>2010-01-20T20:20:22Z</dc:date>
    <item>
      <title>Add Suffix to all variables in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43587#M8933</link>
      <description>I'm looking for a fast way to do this.  I need to add the following to the end of all variables in the dataset:&lt;BR /&gt;
&lt;BR /&gt;
"_3mo"&lt;BR /&gt;
&lt;BR /&gt;
so that&lt;BR /&gt;
&lt;BR /&gt;
ID = ID_3mo&lt;BR /&gt;
&lt;BR /&gt;
Thanks!</description>
      <pubDate>Wed, 20 Jan 2010 20:20:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43587#M8933</guid>
      <dc:creator>statadm</dc:creator>
      <dc:date>2010-01-20T20:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: Add Suffix to all variables in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43588#M8934</link>
      <description>This will work.  &lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select cat(name, ' = ', cats(name, '_3mo' )) into :renstr separated by ' ' from&lt;BR /&gt;
    dictionary.columns where libname = 'WORK' and memname='FMIN';&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
data new;&lt;BR /&gt;
  set fmin (rename = (&amp;amp;renstr));&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 20 Jan 2010 20:35:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43588#M8934</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2010-01-20T20:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: Add Suffix to all variables in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43589#M8935</link>
      <description>There are three of us here and we can't get this to work.  We constantly get the message that there are no rows, which means no observations are brought in.&lt;BR /&gt;
&lt;BR /&gt;
I think we must be missing something...

Message was edited by: statadm</description>
      <pubDate>Wed, 20 Jan 2010 21:58:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43589#M8935</guid>
      <dc:creator>statadm</dc:creator>
      <dc:date>2010-01-20T21:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: Add Suffix to all variables in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43590#M8936</link>
      <description>Suggest you relax the WHERE clause.  The code presumes that you have a SAS file identified in the WHERE clause by the LIBNAME and the MEMNAME variables which must either have been created in this SAS session or referenced with a prior LIBNAME command.&lt;BR /&gt;
&lt;BR /&gt;
Share what code you are attempting to use and do so in a POST reply as a SAS log.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 20 Jan 2010 23:52:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43590#M8936</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-01-20T23:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Add Suffix to all variables in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43591#M8937</link>
      <description>No need to read any records just use &amp;amp;renstr in PROC DATASETS&lt;BR /&gt;
   &lt;BR /&gt;
[pre]&lt;BR /&gt;
proc datasets library=...;&lt;BR /&gt;
   modify ...;&lt;BR /&gt;
   rename &amp;amp;renstr;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 21 Jan 2010 03:34:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43591#M8937</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-01-21T03:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Add Suffix to all variables in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43592#M8938</link>
      <description>Make sure you run the SQL after you have created the data set with the variables you want to rename.</description>
      <pubDate>Thu, 21 Jan 2010 13:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43592#M8938</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2010-01-21T13:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Add Suffix to all variables in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43593#M8939</link>
      <description>Thanks to everyone, it is working now. &lt;BR /&gt;
&lt;BR /&gt;
I didn't realize that the libname and memname had to be UPCASE. I'm obviously new to proc sql.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again!</description>
      <pubDate>Thu, 21 Jan 2010 15:15:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43593#M8939</guid>
      <dc:creator>statadm</dc:creator>
      <dc:date>2010-01-21T15:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: Add Suffix to all variables in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43594#M8940</link>
      <description>statadm&lt;BR /&gt;
it's not so much about sql as about the data it was using.&lt;BR /&gt;
Have a look at the underlying data. Search on the support.sas.com website (most pages have a search box) for dictionary.columns, in product documentation. It will refer you to  page titled "Programming with the SQL Procedure: Accessing SAS System Information by Using DICTIONARY Tables" at &lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/62086/HTML/default/a001385596.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/sqlproc/62086/HTML/default/a001385596.htm&lt;/A&gt; describing many of these dictionary tables, and pointing out that they are also available as "sashelp views". Although you cannot proc print the dictionary.something tables, you can refer to their sashelp.v{name} in proc contents and proc print. &lt;BR /&gt;
So, to print the first few lines of dictionary.tables, [pre]proc print data= sashelp.vtable(obs=10);&lt;BR /&gt;
run;[/pre] Or, when running SAS directly &lt;BR /&gt;
(with Enterprise Guide drill through the server list to libraries, SASHELP and pick VCOLUMN) &lt;BR /&gt;
[without Enterprise Guide, you can drill through the SAS Explorer into SASHELP library and open the item "Vcolumn"]&lt;BR /&gt;
It might take longer to load than that proc print of the first 10 lines, but it is worth the time to experience and discover the extensive nature of the information these sashelp.v{name} aka dictionary tables, offer&lt;BR /&gt;
 &lt;BR /&gt;
PeterC</description>
      <pubDate>Fri, 22 Jan 2010 09:58:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43594#M8940</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-01-22T09:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Add Suffix to all variables in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43595#M8941</link>
      <description>Thanks Peter for helping me to understand.</description>
      <pubDate>Mon, 25 Jan 2010 15:43:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-Suffix-to-all-variables-in-dataset/m-p/43595#M8941</guid>
      <dc:creator>statadm</dc:creator>
      <dc:date>2010-01-25T15:43:49Z</dc:date>
    </item>
  </channel>
</rss>

