<?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: Creating a SAS table from Excel file with data in sheet1 and Variable Labels in Sheet2 in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-SAS-table-from-Excel-file-with-data-in-sheet1-and/m-p/275648#M58581</link>
    <description>&lt;P&gt;Not sure this is a good example for learner to try and do. &amp;nbsp;What you want is to dynamically create code based on some metadata which is a more advanced topic. &amp;nbsp;However here is some code, first read in both sheets to datasets:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set label_dataset end=last;
  if _n_=1 then call execute('data data_dataset; set data_dataset; label');
  call execute(' ',strip(variable),'="',strip(variable_label),'"');
  if last then call execute(';run;');
run;&lt;/PRE&gt;
&lt;P&gt;What the above does is create a datastep with the label &amp;lt;variable&amp;gt;="&amp;lt;variable label&amp;gt;" for each row of your metadata sheet. &amp;nbsp;So saves you typing it all. &amp;nbsp;Again though, it is a more advanced topic, and the questions you should be asking is: is excel the best medium for data transfer, and why are column information on a different sheet?&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jun 2016 13:14:58 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-06-07T13:14:58Z</dc:date>
    <item>
      <title>Creating a SAS table from Excel file with data in sheet1 and Variable Labels in Sheet2</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-SAS-table-from-Excel-file-with-data-in-sheet1-and/m-p/275637#M58580</link>
      <description>&lt;P&gt;Hi SAS coders,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a new learner of SAS, trying to create a SAS data set from excel file where data is in sheet 1 and Variable Labels are in sheet 2 in the following format:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SHEET1: &amp;nbsp;&lt;/STRONG&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;SHEET 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3520i4277AC51B92CA8C3/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="Capture11.PNG" title="Capture11.PNG" /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3522i6BD7AA279F49EE06/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="Capture12.PNG" title="Capture12.PNG" /&gt;&lt;/P&gt;&lt;P&gt;Like this there are 20 columns and their variable labels. Is there a way I can create a data set without manually entering the Variable Labels using Label command? (Using SAS studio)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2016 12:53:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-a-SAS-table-from-Excel-file-with-data-in-sheet1-and/m-p/275637#M58580</guid>
      <dc:creator>Sanchit</dc:creator>
      <dc:date>2016-06-07T12:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a SAS table from Excel file with data in sheet1 and Variable Labels in Sheet2</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-SAS-table-from-Excel-file-with-data-in-sheet1-and/m-p/275648#M58581</link>
      <description>&lt;P&gt;Not sure this is a good example for learner to try and do. &amp;nbsp;What you want is to dynamically create code based on some metadata which is a more advanced topic. &amp;nbsp;However here is some code, first read in both sheets to datasets:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set label_dataset end=last;
  if _n_=1 then call execute('data data_dataset; set data_dataset; label');
  call execute(' ',strip(variable),'="',strip(variable_label),'"');
  if last then call execute(';run;');
run;&lt;/PRE&gt;
&lt;P&gt;What the above does is create a datastep with the label &amp;lt;variable&amp;gt;="&amp;lt;variable label&amp;gt;" for each row of your metadata sheet. &amp;nbsp;So saves you typing it all. &amp;nbsp;Again though, it is a more advanced topic, and the questions you should be asking is: is excel the best medium for data transfer, and why are column information on a different sheet?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2016 13:14:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-a-SAS-table-from-Excel-file-with-data-in-sheet1-and/m-p/275648#M58581</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-06-07T13:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a SAS table from Excel file with data in sheet1 and Variable Labels in Sheet2</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-SAS-table-from-Excel-file-with-data-in-sheet1-and/m-p/275774#M58594</link>
      <description>Thanks for the help! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Jun 2016 18:21:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-a-SAS-table-from-Excel-file-with-data-in-sheet1-and/m-p/275774#M58594</guid>
      <dc:creator>Sanchit</dc:creator>
      <dc:date>2016-06-07T18:21:44Z</dc:date>
    </item>
  </channel>
</rss>

