<?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: Proc SQL to add a suffix to column variable names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-to-add-a-suffix-to-column-variable-names/m-p/739908#M231009</link>
    <description>That is correct, if you look in Dictionary.Columns table it always stores the libname and memname in upper case letters. &lt;BR /&gt;Happy to hear your issue is resolved.&lt;BR /&gt;&lt;BR /&gt;A somewhat safer method in the long run is to up case your comparison all the time, but that can add some extra time to the query.&lt;BR /&gt;&lt;BR /&gt;libname = upper('WORK') and memname = upper('MEANCPUABOTTOMFISH');&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 07 May 2021 21:45:12 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-05-07T21:45:12Z</dc:date>
    <item>
      <title>Proc SQL to add a suffix to column variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-to-add-a-suffix-to-column-variable-names/m-p/739873#M230997</link>
      <description>&lt;P&gt;Hi everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to add a suffix to all column names in a dataset. I'm following the code (example 2)&amp;nbsp;&lt;A href="https://support.sas.com/kb/48/674.html" target="_self"&gt;here&lt;/A&gt;. I have never used proc SQL before. The first portion of the code (the sql part) seems to run ok (no error messages). When I run the second part (proc datasets), I get the following messages:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasSource"&gt;86 proc datasets library = work nolist;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;87 modify meanCPUAbottomfish;&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;WARNING: Apparent symbolic reference LIST not resolved.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;88 rename &amp;amp;list; run;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;_&lt;/DIV&gt;&lt;DIV class="sasError"&gt;22&lt;/DIV&gt;&lt;DIV class="sasError"&gt;76&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Enter RUN; to continue or QUIT; to end the procedure.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 22-322: Expecting a name.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Statements not processed because of errors noted above.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;89 quit;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;How do I fix this error? Thanks.&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 07 May 2021 19:41:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-to-add-a-suffix-to-column-variable-names/m-p/739873#M230997</guid>
      <dc:creator>KaraG</dc:creator>
      <dc:date>2021-05-07T19:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL to add a suffix to column variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-to-add-a-suffix-to-column-variable-names/m-p/739879#M230999</link>
      <description>It's saying your macro variable list doesn't exist. &lt;BR /&gt;Please show how you created the macro variable, the log and the output from the following, before the PROC DATASETS proc:&lt;BR /&gt;&lt;BR /&gt;%put &amp;amp;list.;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 07 May 2021 20:03:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-to-add-a-suffix-to-column-variable-names/m-p/739879#M230999</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-05-07T20:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL to add a suffix to column variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-to-add-a-suffix-to-column-variable-names/m-p/739903#M231005</link>
      <description>Hi, thank you so much for replying. I actually just tried the code again with the dataset name capitalized and it worked...?&lt;BR /&gt;&lt;BR /&gt;Here's the code:&lt;BR /&gt;/* Example 1: */&lt;BR /&gt;/* This code creates a macro variable &amp;amp;list with the list of variables in the form. */&lt;BR /&gt;/* id = id_OLD */&lt;BR /&gt;/* This format could be used to add a suffix to all the variables. */&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select cats(name,'=',name,'_bottom')&lt;BR /&gt;into :list&lt;BR /&gt;separated by ' '&lt;BR /&gt;from dictionary.columns&lt;BR /&gt;where libname = 'WORK' and memname = 'MEANCPUABOTTOMFISH';&lt;BR /&gt;quit;&lt;BR /&gt;*/&lt;BR /&gt;/* Use PROC DATASETS to do the rename using the macro variable you have created. */&lt;BR /&gt;/* Modify the libref and data set name for your data set. */;&lt;BR /&gt;proc datasets library = work nolist;&lt;BR /&gt;modify meanCPUAbottomfish;&lt;BR /&gt;rename &amp;amp;list; run;&lt;BR /&gt;quit;&lt;BR /&gt;/* Verify the changes with a PROC CONTENTS on your data set. */&lt;BR /&gt;proc contents data = MEANCPUABOTTOMFISH;&lt;BR /&gt;run;</description>
      <pubDate>Fri, 07 May 2021 21:13:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-to-add-a-suffix-to-column-variable-names/m-p/739903#M231005</guid>
      <dc:creator>KaraG</dc:creator>
      <dc:date>2021-05-07T21:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL to add a suffix to column variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-to-add-a-suffix-to-column-variable-names/m-p/739908#M231009</link>
      <description>That is correct, if you look in Dictionary.Columns table it always stores the libname and memname in upper case letters. &lt;BR /&gt;Happy to hear your issue is resolved.&lt;BR /&gt;&lt;BR /&gt;A somewhat safer method in the long run is to up case your comparison all the time, but that can add some extra time to the query.&lt;BR /&gt;&lt;BR /&gt;libname = upper('WORK') and memname = upper('MEANCPUABOTTOMFISH');&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 07 May 2021 21:45:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-to-add-a-suffix-to-column-variable-names/m-p/739908#M231009</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-05-07T21:45:12Z</dc:date>
    </item>
  </channel>
</rss>

