<?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 How to use the distinct variable values as an array{} in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-the-distinct-variable-values-as-an-array/m-p/204895#M51033</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I have a data set with about 4000 observations and about 100 distinct types in the variable type column. I need to print each type of data to one excel file with different worksheets and the worksheet name is the type name. &lt;/P&gt;&lt;P&gt;For example, I have&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data dset missover;&lt;/P&gt;&lt;P&gt;input id type$ rev1 rev2 notes$;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 1 a 20 10 yet&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 2 b 10 15 yes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 3 c 15 12 no&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 4 b 10 10&amp;nbsp; . &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 5 a 10&amp;nbsp; . yet &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 6 d 10&amp;nbsp; 2 ok&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 7 e 5&amp;nbsp;&amp;nbsp; 5 but&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 8 g 20 30 one&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 9 k 5&amp;nbsp; 6&amp;nbsp; three&lt;/P&gt;&lt;P&gt;&amp;nbsp; 10 g 8&amp;nbsp; 9&amp;nbsp; one&amp;nbsp; &lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the distinct types are: a, b, c, d, e, g, k in this example&lt;/P&gt;&lt;P&gt;I expect to print one excel or csv file with&lt;/P&gt;&lt;P&gt;worksheet name: a&lt;/P&gt;&lt;P&gt;id type rev1 rev2 notes&lt;/P&gt;&lt;P&gt;1&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp; yet&lt;/P&gt;&lt;P&gt;5&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp; yet&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;worksheet name: b&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;id type rev1 rev2 notes&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;2&amp;nbsp; b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp; 15&amp;nbsp;&amp;nbsp;&amp;nbsp; yes&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;4&amp;nbsp; b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;worksheet name: c&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;id type rev1 rev2 notes&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;3&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp;&amp;nbsp; no&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;.......&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;and so on......&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;I expect to use the distinct type names as an array when I print each worksheet, since the types will be changed each time and there are more than 100 types when I do the report.&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Any suggestions, solutions, or hints will be very appreciated. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Aug 2015 19:16:12 GMT</pubDate>
    <dc:creator>Yurie</dc:creator>
    <dc:date>2015-08-21T19:16:12Z</dc:date>
    <item>
      <title>How to use the distinct variable values as an array{}</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-the-distinct-variable-values-as-an-array/m-p/204895#M51033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I have a data set with about 4000 observations and about 100 distinct types in the variable type column. I need to print each type of data to one excel file with different worksheets and the worksheet name is the type name. &lt;/P&gt;&lt;P&gt;For example, I have&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data dset missover;&lt;/P&gt;&lt;P&gt;input id type$ rev1 rev2 notes$;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 1 a 20 10 yet&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 2 b 10 15 yes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 3 c 15 12 no&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 4 b 10 10&amp;nbsp; . &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 5 a 10&amp;nbsp; . yet &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 6 d 10&amp;nbsp; 2 ok&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 7 e 5&amp;nbsp;&amp;nbsp; 5 but&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 8 g 20 30 one&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 9 k 5&amp;nbsp; 6&amp;nbsp; three&lt;/P&gt;&lt;P&gt;&amp;nbsp; 10 g 8&amp;nbsp; 9&amp;nbsp; one&amp;nbsp; &lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the distinct types are: a, b, c, d, e, g, k in this example&lt;/P&gt;&lt;P&gt;I expect to print one excel or csv file with&lt;/P&gt;&lt;P&gt;worksheet name: a&lt;/P&gt;&lt;P&gt;id type rev1 rev2 notes&lt;/P&gt;&lt;P&gt;1&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp; yet&lt;/P&gt;&lt;P&gt;5&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp; yet&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;worksheet name: b&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;id type rev1 rev2 notes&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;2&amp;nbsp; b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp; 15&amp;nbsp;&amp;nbsp;&amp;nbsp; yes&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;4&amp;nbsp; b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;worksheet name: c&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;id type rev1 rev2 notes&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;3&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp;&amp;nbsp; no&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;.......&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;and so on......&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;I expect to use the distinct type names as an array when I print each worksheet, since the types will be changed each time and there are more than 100 types when I do the report.&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Any suggestions, solutions, or hints will be very appreciated. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Aug 2015 19:16:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-the-distinct-variable-values-as-an-array/m-p/204895#M51033</guid>
      <dc:creator>Yurie</dc:creator>
      <dc:date>2015-08-21T19:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the distinct variable values as an array{}</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-the-distinct-variable-values-as-an-array/m-p/204896#M51034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds overly complicated to use an array. Looks like you just got a list report. Sort your data and proc print by? (Not tested)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Aug 2015 19:27:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-the-distinct-variable-values-as-an-array/m-p/204896#M51034</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-08-21T19:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the distinct variable values as an array{}</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-the-distinct-variable-values-as-an-array/m-p/204897#M51035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This might give you a working start. It creates an XML file that Excel can open. I use the xml extension to avoid the Excel name doesn't match file extension warnings.&lt;/P&gt;&lt;P&gt;The tabs are named Type=a, Type=B instead of just a, b etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=dset; by type;run;&lt;/P&gt;&lt;P&gt;ods tagsets.excelxp file="C:\data\types.xml"&lt;BR /&gt;options (sheet_interval='Bygroup') style=meadow;&lt;/P&gt;&lt;P&gt;proc print data=dset noobs label;&lt;BR /&gt;by type;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;ods tagsets.excelxp close;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Aug 2015 19:33:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-the-distinct-variable-values-as-an-array/m-p/204897#M51035</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-08-21T19:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the distinct variable values as an array{}</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-the-distinct-variable-values-as-an-array/m-p/204898#M51036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Ballardw&lt;/P&gt;&lt;P&gt;Thank you so, so much! The result&amp;nbsp; is what I wanted! &lt;/P&gt;&lt;P&gt;--Yurie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Aug 2015 19:40:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-the-distinct-variable-values-as-an-array/m-p/204898#M51036</guid>
      <dc:creator>Yurie</dc:creator>
      <dc:date>2015-08-21T19:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the distinct variable values as an array{}</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-the-distinct-variable-values-as-an-array/m-p/204899#M51037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you're looking for something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A __default_attr="86563" __jive_macro_name="thread" class="jive_macro jive_macro_thread" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Aug 2015 19:41:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-the-distinct-variable-values-as-an-array/m-p/204899#M51037</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-08-21T19:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the distinct variable values as an array{}</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-the-distinct-variable-values-as-an-array/m-p/204900#M51038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, if its one workbook then @ballardw solution is correct, use the SHEET_INTERVAL option in ODS TAGSETS.EXCELXP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I don't know how that would be organized as CSV, would it be one group per CSV file so multiple CSV files?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Aug 2015 19:43:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-the-distinct-variable-values-as-an-array/m-p/204900#M51038</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-08-21T19:43:37Z</dc:date>
    </item>
  </channel>
</rss>

