<?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 Assigning labels to a large amount of variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Assigning-labels-to-a-large-amount-of-variables/m-p/27433#M6253</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a dataset with about 500 variables. The all startwith the prefix “ftc”. So, ftc1, ftc2, ftc3, ftc4…. I have to assign a label to each one removing the “ftc” and replacing it with a “Q” so Q1, Q2, Q3, Q4. Isthere a ay to do this to a very large group of variables at once? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Mar 2012 21:49:06 GMT</pubDate>
    <dc:creator>RobertNYC</dc:creator>
    <dc:date>2012-03-09T21:49:06Z</dc:date>
    <item>
      <title>Assigning labels to a large amount of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assigning-labels-to-a-large-amount-of-variables/m-p/27433#M6253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a dataset with about 500 variables. The all startwith the prefix “ftc”. So, ftc1, ftc2, ftc3, ftc4…. I have to assign a label to each one removing the “ftc” and replacing it with a “Q” so Q1, Q2, Q3, Q4. Isthere a ay to do this to a very large group of variables at once? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 21:49:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assigning-labels-to-a-large-amount-of-variables/m-p/27433#M6253</guid>
      <dc:creator>RobertNYC</dc:creator>
      <dc:date>2012-03-09T21:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning labels to a large amount of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assigning-labels-to-a-large-amount-of-variables/m-p/27434#M6254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;/*create test file*/&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain ftc1-ftc500 (500*1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have (rename=(ftc1-ftc500=q1-q500));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now that I have also seen my colleague's responses, I have to wonder if I correctly interpreted what you wanted.&amp;nbsp; My approach was simply renaming the variables. Is that what you wanted to or, as in your subject line, did you actually want to assign labels?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is the latter, please disregard my response.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 21:54:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assigning-labels-to-a-large-amount-of-variables/m-p/27434#M6254</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-03-09T21:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning labels to a large amount of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assigning-labels-to-a-large-amount-of-variables/m-p/27435#M6255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Code gen.&lt;/P&gt;&lt;P&gt;- If you have a good editor you could just do it in the editor.&amp;nbsp; If I still had &lt;A href="http://en.wikipedia.org/wiki/ORVYL_and_WYLBUR"&gt;WYLBUR&lt;/A&gt; I could do it with a couple of change commands.&lt;/P&gt;&lt;P&gt;- Macro logic.&lt;/P&gt;&lt;P&gt;- Data step logic to write to a file.&lt;/P&gt;&lt;P&gt;- Proc sql to store code in a macro variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once youve generated the variable labels pairs then you also have options on how to apply them.&lt;/P&gt;&lt;P&gt;- DATA step to create a new (or overwrite the old) dataset by reading the existing one.&lt;/P&gt;&lt;P&gt;- PROC SQL code to do the same.&lt;/P&gt;&lt;P&gt;- PROC DATASETS MODIFY code to just modify the labels of the variables without having to create (re-create) the dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;filename code temp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; file code;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put 'label ';&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to 500;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put 'ftc' i '="Q' i '"' ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put ';';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data new;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set old;&lt;/P&gt;&lt;P&gt;%inc code;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 22:01:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assigning-labels-to-a-large-amount-of-variables/m-p/27435#M6255</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-03-09T22:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning labels to a large amount of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assigning-labels-to-a-large-amount-of-variables/m-p/27436#M6256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ... another idea&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;data x;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;retain ftc1-ftc100 1 a b c 'other';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;proc sql noprint;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;select catt(name, '= "Q' , compress(name,,'kd'),'"') into :labels separated by ' '&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;from dictionary.columns where libname eq 'WORK' and memname eq 'X' and name eqt 'ftc';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;quit; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;proc datasets lib=work nolist;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;modify x;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;label &amp;amp;labels;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;%symdel labels;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 22:44:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assigning-labels-to-a-large-amount-of-variables/m-p/27436#M6256</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2012-03-09T22:44:40Z</dc:date>
    </item>
  </channel>
</rss>

