<?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: Update variable label from different data set in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Update-variable-label-from-different-data-set/m-p/64553#M18326</link>
    <description>Thank for all of your posts.  I figured this out by using a macro to cycle through the vars I'm working with.  In the macro I generate a sas that has the label statement properly formatted.  I created it in a seperate file because of the number of variables I have in some of my tables.  I'm dealing with over 5000 variables.  &lt;BR /&gt;
So i have 10 or so files that have label statements.  Within my main program I use a macro to create the dataset.  Within that macro I have a data step that has the %include as part of it.  So all my labels get updated.  I think I took the long route but I have to have pretty log files and this way does that.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again for all of your help</description>
    <pubDate>Wed, 11 May 2011 18:16:52 GMT</pubDate>
    <dc:creator>jerry898969</dc:creator>
    <dc:date>2011-05-11T18:16:52Z</dc:date>
    <item>
      <title>Update variable label from different data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Update-variable-label-from-different-data-set/m-p/64549#M18322</link>
      <description>I have a data set that I want to update the labels too.  I have another dataset that lists the variable name and the new label.  What is the best way to approach this?&lt;BR /&gt;
&lt;BR /&gt;
TABLE 1 lets say has 3 variables.  (Mine has many more)&lt;BR /&gt;
var1 var2 var3&lt;BR /&gt;
The labels for these variables could be 'label1' 'label2' 'label3' .&lt;BR /&gt;
&lt;BR /&gt;
I want to update these labels based on another dataset&lt;BR /&gt;
&lt;BR /&gt;
I have another dataset that has &lt;BR /&gt;
var1 'This is variable 1'&lt;BR /&gt;
var2 'This is variable 2'&lt;BR /&gt;
var3 'This is variable 3'&lt;BR /&gt;
&lt;BR /&gt;
So my final file will have these as the labels not  'label1' 'label2' 'label3' .&lt;BR /&gt;
&lt;BR /&gt;
Thank you in advance for any help.</description>
      <pubDate>Tue, 10 May 2011 19:16:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Update-variable-label-from-different-data-set/m-p/64549#M18322</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2011-05-10T19:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: Update variable label from different data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Update-variable-label-from-different-data-set/m-p/64550#M18323</link>
      <description>Jerry,&lt;BR /&gt;
&lt;BR /&gt;
Other than the labels, and number of records, are the two datasets the same (i.e., each with the same number of variables, same variable names and same lengths and formats)?&lt;BR /&gt;
&lt;BR /&gt;
Art</description>
      <pubDate>Tue, 10 May 2011 21:16:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Update-variable-label-from-different-data-set/m-p/64550#M18323</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-05-10T21:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Update variable label from different data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Update-variable-label-from-different-data-set/m-p/64551#M18324</link>
      <description>With a DATA step approach, you can use VLABEL function to retrieve the assigned variable label and also use the CALL LABEL function to assign the label-value.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search arguments, this topic/post:&lt;BR /&gt;
&lt;BR /&gt;
assign variable label site:sas.com&lt;BR /&gt;
vlabel function site:sas.com</description>
      <pubDate>Tue, 10 May 2011 21:24:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Update-variable-label-from-different-data-set/m-p/64551#M18324</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-05-10T21:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: Update variable label from different data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Update-variable-label-from-different-data-set/m-p/64552#M18325</link>
      <description>Give you an example which I have coded before.&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
%let libname=work;&lt;BR /&gt;
options compress=yes;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
* _col1 is table name _col3 is english variable name _col4 is label;&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
 set work.label(where=(_col1 is not missing)) end=last;&lt;BR /&gt;
 if _n_ eq 1 then call execute("proc datasets library=&amp;amp;libname memtype=data;" );&lt;BR /&gt;
 if _col1 ne lag(_col1) then call execute('modify '||compress(_col1)||';');&lt;BR /&gt;
 call execute('label '||compress(_col3)||'="'||compress(_col4)||'";');&lt;BR /&gt;
 if last then call execute('quit;');&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Wed, 11 May 2011 00:57:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Update-variable-label-from-different-data-set/m-p/64552#M18325</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-05-11T00:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: Update variable label from different data set</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Update-variable-label-from-different-data-set/m-p/64553#M18326</link>
      <description>Thank for all of your posts.  I figured this out by using a macro to cycle through the vars I'm working with.  In the macro I generate a sas that has the label statement properly formatted.  I created it in a seperate file because of the number of variables I have in some of my tables.  I'm dealing with over 5000 variables.  &lt;BR /&gt;
So i have 10 or so files that have label statements.  Within my main program I use a macro to create the dataset.  Within that macro I have a data step that has the %include as part of it.  So all my labels get updated.  I think I took the long route but I have to have pretty log files and this way does that.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again for all of your help</description>
      <pubDate>Wed, 11 May 2011 18:16:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Update-variable-label-from-different-data-set/m-p/64553#M18326</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2011-05-11T18:16:52Z</dc:date>
    </item>
  </channel>
</rss>

