<?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: labeling more than 400 variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/labeling-more-than-400-variables/m-p/526920#M143592</link>
    <description>&lt;P&gt;Let's make up some data that more or less resembles what you imported from Excel:&lt;/P&gt;
&lt;P&gt;Data from the first spreadsheet, with two columns:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mydata;
input var1 $ var2;
cards;
x 1
y 2
z 3
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Data from the second spreadsheet, with two lines:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data headers;
infile cards dlm=',';
input col_a $ col_b :$64.;
cards;
var1,this is the label for var1
var2,this is the label for var2
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now let's use the second dataset to dynamically create a proc datasets step that sets the labels:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set headers end=eof;
if _n_ = 1 then call execute('proc datasets noprint; modify mydata; label ');
call execute(col_a !! ' = "' !! strip(col_b) !! '" ');
if eof then call execute('; run; quit;');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and print the result:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=mydata noobs label;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is what we get:&lt;/P&gt;
&lt;PRE&gt; this is      this is
the label    the label
for var1      for var2

    x            1    
    y            2    
    z            3    
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Jan 2019 13:15:21 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-01-14T13:15:21Z</dc:date>
    <item>
      <title>labeling more than 400 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/labeling-more-than-400-variables/m-p/526854#M143570</link>
      <description>&lt;P&gt;I have tow excel files.&lt;/P&gt;&lt;P&gt;First one contain the original data which contains data from a company&lt;/P&gt;&lt;P&gt;The second file contains all the labels for the above data headers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is that how to label all the headers present in the first file according to the labels present in second file. There are more than 400 header in first file which are needed to properly labeled by the labels present in second file&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 06:42:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/labeling-more-than-400-variables/m-p/526854#M143570</guid>
      <dc:creator>akki39k</dc:creator>
      <dc:date>2019-01-14T06:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: labeling more than 400 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/labeling-more-than-400-variables/m-p/526889#M143582</link>
      <description>&lt;P&gt;How do they correspond to each other? By position in the spreadsheet only, or do you have name/label pairs?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 10:10:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/labeling-more-than-400-variables/m-p/526889#M143582</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-14T10:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: labeling more than 400 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/labeling-more-than-400-variables/m-p/526911#M143588</link>
      <description>&lt;P&gt;I have name label pairs in the second file like&lt;/P&gt;&lt;P&gt;Name of the header in A1 and corresponding label in B2 of spreadsheet&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 13:00:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/labeling-more-than-400-variables/m-p/526911#M143588</guid>
      <dc:creator>akki39k</dc:creator>
      <dc:date>2019-01-14T13:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: labeling more than 400 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/labeling-more-than-400-variables/m-p/526916#M143591</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/251615"&gt;@akki39k&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have name label pairs in the second file like&lt;/P&gt;
&lt;P&gt;Name of the header in A1 and corresponding label in B2 of spreadsheet&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Is this a typographical error? Should it say: name of the header in A2 and label in B2?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Can you show us a few records of these label pairs?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 13:06:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/labeling-more-than-400-variables/m-p/526916#M143591</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-14T13:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: labeling more than 400 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/labeling-more-than-400-variables/m-p/526920#M143592</link>
      <description>&lt;P&gt;Let's make up some data that more or less resembles what you imported from Excel:&lt;/P&gt;
&lt;P&gt;Data from the first spreadsheet, with two columns:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mydata;
input var1 $ var2;
cards;
x 1
y 2
z 3
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Data from the second spreadsheet, with two lines:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data headers;
infile cards dlm=',';
input col_a $ col_b :$64.;
cards;
var1,this is the label for var1
var2,this is the label for var2
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now let's use the second dataset to dynamically create a proc datasets step that sets the labels:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set headers end=eof;
if _n_ = 1 then call execute('proc datasets noprint; modify mydata; label ');
call execute(col_a !! ' = "' !! strip(col_b) !! '" ');
if eof then call execute('; run; quit;');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and print the result:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=mydata noobs label;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is what we get:&lt;/P&gt;
&lt;PRE&gt; this is      this is
the label    the label
for var1      for var2

    x            1    
    y            2    
    z            3    
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 13:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/labeling-more-than-400-variables/m-p/526920#M143592</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-14T13:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: labeling more than 400 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/labeling-more-than-400-variables/m-p/526938#M143597</link>
      <description>&lt;P&gt;My second file looks like this&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 14:23:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/labeling-more-than-400-variables/m-p/526938#M143597</guid>
      <dc:creator>akki39k</dc:creator>
      <dc:date>2019-01-14T14:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: labeling more than 400 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/labeling-more-than-400-variables/m-p/526939#M143598</link>
      <description>&lt;P&gt;So you just have to use variable in place of col_a and label in place of col_b.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 14:28:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/labeling-more-than-400-variables/m-p/526939#M143598</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-14T14:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: labeling more than 400 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/labeling-more-than-400-variables/m-p/526943#M143600</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;for looking into my concern and providing the solution&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 14:39:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/labeling-more-than-400-variables/m-p/526943#M143600</guid>
      <dc:creator>akki39k</dc:creator>
      <dc:date>2019-01-14T14:39:42Z</dc:date>
    </item>
  </channel>
</rss>

