<?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: Store variable names and labels in data set and assign labels automatically? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Store-variable-names-and-labels-in-data-set-and-assign-labels/m-p/306141#M65424</link>
    <description>&lt;P&gt;OK. Here is my example . written by me,Matt and Arthur.T.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings15/2785-2015.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings15/2785-2015.pdf&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Oct 2016 01:35:21 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-10-21T01:35:21Z</dc:date>
    <item>
      <title>Store variable names and labels in data set and assign labels automatically?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Store-variable-names-and-labels-in-data-set-and-assign-labels/m-p/157573#M30751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a very large data set with many variables with different names and labels (more than 300 hundred of them), I also have a excel file with variable names and descriptions (which I want use as labels). I'm able to import these into new sas data set (let's call it label data set), so I have sas data set with variable names and their labels. How could I code a macro which would use this label data set to assign labels for variables in my large data set?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Feb 2015 15:50:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Store-variable-names-and-labels-in-data-set-and-assign-labels/m-p/157573#M30751</guid>
      <dc:creator>gabon</dc:creator>
      <dc:date>2015-02-07T15:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: Store variable names and labels in data set and assign labels automatically?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Store-variable-names-and-labels-in-data-set-and-assign-labels/m-p/157574#M30752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create a macro variable using proc sql that is of the form &lt;/P&gt;&lt;P&gt;Variable_Name1 = "Variable Label1"&lt;/P&gt;&lt;P&gt;Variable_Name2 = "Variable Label2"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's an example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Create label data set;&lt;/P&gt;&lt;P&gt;data label_data_set;&lt;/P&gt;&lt;P&gt;length name label $25.;&lt;/P&gt;&lt;P&gt;name="Sex"; label="Gender"; output;&lt;/P&gt;&lt;P&gt;name="height"; label="Height (in)"; output;&lt;/P&gt;&lt;P&gt;name="weight"; label="Weight (lbs)"; output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Create sample dataset to apply label;&lt;/P&gt;&lt;P&gt;data class;&lt;/P&gt;&lt;P&gt;set sashelp.class;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Create macro variable that holds label statement;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;select catx("=", name, quote(trim(label))) &lt;/P&gt;&lt;P&gt;&amp;nbsp; into :label_list separated by " "&lt;/P&gt;&lt;P&gt;from label_data_set;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Display macro variable in log;&lt;/P&gt;&lt;P&gt;%put &amp;amp;label_list.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Apply labels without recreating dataset;&lt;/P&gt;&lt;P&gt;proc datasets library=work;&lt;/P&gt;&lt;P&gt;modify class;&lt;/P&gt;&lt;P&gt;label &amp;amp;label_list.;&lt;/P&gt;&lt;P&gt;run;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Print the dataset to display new labels;&lt;/P&gt;&lt;P&gt;proc print data=class label noobs;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Feb 2015 16:24:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Store-variable-names-and-labels-in-data-set-and-assign-labels/m-p/157574#M30752</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-07T16:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Store variable names and labels in data set and assign labels automatically?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Store-variable-names-and-labels-in-data-set-and-assign-labels/m-p/157575#M30753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much!!! It worked &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Feb 2015 17:28:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Store-variable-names-and-labels-in-data-set-and-assign-labels/m-p/157575#M30753</guid>
      <dc:creator>gabon</dc:creator>
      <dc:date>2015-02-07T17:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: Store variable names and labels in data set and assign labels automatically?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Store-variable-names-and-labels-in-data-set-and-assign-labels/m-p/157576#M30754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you encounter the limitation of Macro variable's Length , consider using CALL EXECUTE () .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Feb 2015 07:48:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Store-variable-names-and-labels-in-data-set-and-assign-labels/m-p/157576#M30754</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-02-08T07:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Store variable names and labels in data set and assign labels automatically?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Store-variable-names-and-labels-in-data-set-and-assign-labels/m-p/306132#M65419</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp﻿&lt;/a&gt;&amp;nbsp;Would &amp;nbsp;you mind showing it using &amp;nbsp;CALL EXECUTE?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 00:47:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Store-variable-names-and-labels-in-data-set-and-assign-labels/m-p/306132#M65419</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-10-21T00:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Store variable names and labels in data set and assign labels automatically?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Store-variable-names-and-labels-in-data-set-and-assign-labels/m-p/306141#M65424</link>
      <description>&lt;P&gt;OK. Here is my example . written by me,Matt and Arthur.T.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings15/2785-2015.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings15/2785-2015.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 01:35:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Store-variable-names-and-labels-in-data-set-and-assign-labels/m-p/306141#M65424</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-10-21T01:35:21Z</dc:date>
    </item>
  </channel>
</rss>

