<?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 change label case in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/change-label-case/m-p/357326#M274255</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have following dataset with label names:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; class;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; sashelp.class;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;label&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; name=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"NAme"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; sex=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"GEndeR"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; age=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Age"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; height=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"HeiGht"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; weight=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"kilograms"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;I need to change all label names to upcase/lowcase/propcase for all variables in one step.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Can anyone please help?&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 09 May 2017 22:47:19 GMT</pubDate>
    <dc:creator>ramchinna24</dc:creator>
    <dc:date>2017-05-09T22:47:19Z</dc:date>
    <item>
      <title>change label case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-label-case/m-p/357326#M274255</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have following dataset with label names:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; class;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; sashelp.class;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;label&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; name=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"NAme"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; sex=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"GEndeR"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; age=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Age"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; height=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"HeiGht"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; weight=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"kilograms"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;I need to change all label names to upcase/lowcase/propcase for all variables in one step.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Can anyone please help?&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2017 22:47:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-label-case/m-p/357326#M274255</guid>
      <dc:creator>ramchinna24</dc:creator>
      <dc:date>2017-05-09T22:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: change label case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-label-case/m-p/357328#M274256</link>
      <description>&lt;P&gt;Are you familiar with using the SASHELP.VCOLUMN dataset? I suggest you look there first as it has the labels all stored in the file as well variable names so you can derive them easily in one place to convert them.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;I need to change all label names to upcase/lowcase/propcase for all variables in one step.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Can anyone please help?&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2017 22:52:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-label-case/m-p/357328#M274256</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-09T22:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: change label case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-label-case/m-p/357338#M274257</link>
      <description>&lt;P&gt;Even if you know how to automate the retrieval of labels, it's not necessarily simple to change the labels. &amp;nbsp;And there's certainly more than one approach to doing it. &amp;nbsp;Here's a method that retrieves the labels from PROC CONTENTS:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;proc contents data=have &lt;/FONT&gt;noprint&lt;FONT face="courier new,courier"&gt;&amp;nbsp;out=_contents_ (keep=name label where=(label &amp;gt; ' '));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then applying them might look like this (this is untested code, but should be working):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;proc sql;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;select name || '= "' || propcase(label) || '"' into : label_list from _contents_ separated by ' ' ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;data want;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;set have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;label &amp;amp;label_list;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;run;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2017 23:39:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-label-case/m-p/357338#M274257</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-05-09T23:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: change label case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-label-case/m-p/357350#M274258</link>
      <description>&lt;P&gt;Here's another way, some benefits to this method:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Proc datasets - doesn't recreate the dataset directly so it's faster&lt;/P&gt;
&lt;P&gt;2. Uses SASHELP.VCOLUMN/Dictionary.Column that can be leveraged across multiple datasets&lt;/P&gt;
&lt;P&gt;3. Accounts for variables that may not have labels, in this case it uses the variable name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. This uses propcase. You can change it to lowcase or upcase as preferred.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
    set sashelp.class;
    label name="NAme" sex="GEndeR" age="Age" height="HeiGht" weight="kilograms";
run;

proc sql noprint;
    select catx('=', name, quote(propcase(coalescec(trim(label), name)))) 
        into :label_list separated by " " from sashelp.vcolumn where libname='WORK' 
        and upper(memname)='CLASS';
quit;

proc datasets lib=work nodetails nolist;
    modify class;
    label &amp;amp;label_list;
    run;
quit;

proc print data=class label;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 May 2017 01:03:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-label-case/m-p/357350#M274258</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-10T01:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: change label case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-label-case/m-p/357362#M274259</link>
      <description>Thank you Reeza</description>
      <pubDate>Wed, 10 May 2017 03:06:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-label-case/m-p/357362#M274259</guid>
      <dc:creator>ramchinna24</dc:creator>
      <dc:date>2017-05-10T03:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: change label case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-label-case/m-p/357510#M274260</link>
      <description>&lt;P&gt;Propcase, while a very helpful function in many cases does have some weekness especially if you have text such as 'mg/dl' where propcase will return 'Mg/Dl' which is not quite standard or will turn "MacDonald" into "Macdonald". If your data doesn't hanve any of these then no problem but there may be a bit of manual clean up on process still.&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2017 14:51:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-label-case/m-p/357510#M274260</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-10T14:51:33Z</dc:date>
    </item>
  </channel>
</rss>

