<?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 Data step with multiple data sets in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Data-step-with-multiple-data-sets/m-p/19171#M3848</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am bringing an Excel file,with two worksheets, into SAS 9.2.&amp;nbsp; I want each worksheet to be a data set.&amp;nbsp; I add labels and informats and formats and everything works fine doing two data steps.&amp;nbsp; Out of curiosity, is there a way to set labels, informats and formats for two different data sets in the &lt;EM&gt;same &lt;/EM&gt;data step?&amp;nbsp; In other words, can you reference a specific data sets' attributes within a given data step?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Adrian.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Dec 2011 22:13:08 GMT</pubDate>
    <dc:creator>stygian</dc:creator>
    <dc:date>2011-12-21T22:13:08Z</dc:date>
    <item>
      <title>Data step with multiple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-step-with-multiple-data-sets/m-p/19171#M3848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am bringing an Excel file,with two worksheets, into SAS 9.2.&amp;nbsp; I want each worksheet to be a data set.&amp;nbsp; I add labels and informats and formats and everything works fine doing two data steps.&amp;nbsp; Out of curiosity, is there a way to set labels, informats and formats for two different data sets in the &lt;EM&gt;same &lt;/EM&gt;data step?&amp;nbsp; In other words, can you reference a specific data sets' attributes within a given data step?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Adrian.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 22:13:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-step-with-multiple-data-sets/m-p/19171#M3848</guid>
      <dc:creator>stygian</dc:creator>
      <dc:date>2011-12-21T22:13:08Z</dc:date>
    </item>
    <item>
      <title>Data step with multiple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-step-with-multiple-data-sets/m-p/19172#M3849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not?&amp;nbsp; If you are using the libname method to identify the files, and bringing them in with set statements, you can always define the two (or more) desired output files in the data statement, grab the filenames by using the indsname option in the set statements to grab the filenames (see: &lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000173782.htm"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000173782.htm&lt;/A&gt; ), and then just include an if then statement to route the input records to their desired output files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be especially handy if all of the input files needed the same formats and labels, etc. to be defined the same way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 23:16:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-step-with-multiple-data-sets/m-p/19172#M3849</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-12-21T23:16:03Z</dc:date>
    </item>
    <item>
      <title>Data step with multiple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-step-with-multiple-data-sets/m-p/19173#M3850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't use a DATA step. Use PROC DATASETS instead for such metadata tasks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Dec 2011 03:16:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-step-with-multiple-data-sets/m-p/19173#M3850</guid>
      <dc:creator>Howles</dc:creator>
      <dc:date>2011-12-22T03:16:33Z</dc:date>
    </item>
    <item>
      <title>Data step with multiple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-step-with-multiple-data-sets/m-p/19174#M3851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes. But you need to use proc datasets - a tool of managing datasets.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a;set sashelp.class;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc datasets library=work nolist;&lt;/P&gt;&lt;P&gt; modify a;&lt;/P&gt;&lt;P&gt; attrib name label='N' format=$10. ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Dec 2011 03:20:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-step-with-multiple-data-sets/m-p/19174#M3851</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-12-22T03:20:02Z</dc:date>
    </item>
    <item>
      <title>Data step with multiple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-step-with-multiple-data-sets/m-p/19175#M3852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Howard and KSharp,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the files already existed as SAS files I'd agree.&amp;nbsp; But, in this case since the files need to be processed anyhow and, knowing Excel files probably will need some manipulation on top of the metadata, why do you both say NOT to use a datastep?&amp;nbsp; Just curious.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Dec 2011 04:57:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-step-with-multiple-data-sets/m-p/19175#M3852</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-12-22T04:57:43Z</dc:date>
    </item>
    <item>
      <title>Data step with multiple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-step-with-multiple-data-sets/m-p/19176#M3853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Art .&lt;/P&gt;&lt;P&gt;Ou? It looks like I don't understand what OP means exactly.&lt;/P&gt;&lt;P&gt;But you can always change the label or format after importing data .&lt;/P&gt;&lt;P&gt;You see?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Dec 2011 05:11:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-step-with-multiple-data-sets/m-p/19176#M3853</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-12-22T05:11:12Z</dc:date>
    </item>
    <item>
      <title>Re: Data step with multiple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-step-with-multiple-data-sets/m-p/19177#M3854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can create two datasets with one DATA step, so yes you can assign labels and formats to two datasets at once.&lt;/P&gt;&lt;P&gt;But unless the variables in the two Excel sheets are the same you will have other work to do.&lt;/P&gt;&lt;P&gt;There are other methods that can used to make sure attributes of variables are defined consistently across datasets.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One method is to store the statements into a macro variable and then use that in two different places.&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;%let attrib=%str(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; attrib id length=$10 label='Patient Id';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; attrib sex length=$1 label='Gender (M/F)';&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data one;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;amp;attrib&lt;/P&gt;&lt;P&gt;&amp;nbsp; set excel.sheet1 ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data two;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;amp;attrib&lt;/P&gt;&lt;P&gt;&amp;nbsp; set excel.sheet2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other is to reference an existing dataset that has the variables defined.&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;data two ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if 0 then set one;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set excel.sheet2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However if you are using Excel as a data source you will need to check it carefully. Make sure the columns actually contain consistent values that can be treated as a variable in a dataset because Excel is designed for spread sheet calculations and any cell could contain any type of data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Dec 2011 12:20:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-step-with-multiple-data-sets/m-p/19177#M3854</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2011-12-22T12:20:36Z</dc:date>
    </item>
  </channel>
</rss>

