<?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: reading data from a multi-way table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/reading-data-from-a-multi-way-table/m-p/310307#M66917</link>
    <description>&lt;PRE&gt;
You could read it as and transpose it.



data have;
input    var1 $ var2 $       smoker    nonsmoker;
cards;
male    white       10           20
 .      others      20           30
female  white       30           40
 .      others      30           30
;
run;
proc transpose data=have out=want;
by var1 var2 notsorted;
var smoker nonsmoker;
run;

&lt;/PRE&gt;</description>
    <pubDate>Wed, 09 Nov 2016 07:45:01 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-11-09T07:45:01Z</dc:date>
    <item>
      <title>reading data from a multi-way table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-from-a-multi-way-table/m-p/310279#M66908</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to read data from a table that has multiple 'dimensions'. At first, it is just a 3 way table like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&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; smoker &amp;nbsp; &amp;nbsp;nonsmoker&lt;/P&gt;&lt;P&gt;male &amp;nbsp; &amp;nbsp; white &amp;nbsp; &amp;nbsp; &amp;nbsp; 10 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; others &amp;nbsp; &amp;nbsp; &amp;nbsp;20 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 30&lt;/P&gt;&lt;P&gt;female &amp;nbsp;white &amp;nbsp; &amp;nbsp; &amp;nbsp; 30 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 40&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;others &amp;nbsp; &amp;nbsp; &amp;nbsp;30 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 30&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I just write:&lt;/P&gt;&lt;P&gt;input gender race smoker count;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1 1 1 10&lt;/P&gt;&lt;P&gt;1 1 2 20&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;however when the table becomes bigger and bigger and having more variables the task becomes quite hard (like the table in the attachment), and I'm wondering if there are any easier way to input data like that?&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13119i55C5260FD636C83C/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="1.jpg" title="1.jpg" /&gt;</description>
      <pubDate>Wed, 09 Nov 2016 05:43:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-from-a-multi-way-table/m-p/310279#M66908</guid>
      <dc:creator>joseph626</dc:creator>
      <dc:date>2016-11-09T05:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: reading data from a multi-way table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-from-a-multi-way-table/m-p/310307#M66917</link>
      <description>&lt;PRE&gt;
You could read it as and transpose it.



data have;
input    var1 $ var2 $       smoker    nonsmoker;
cards;
male    white       10           20
 .      others      20           30
female  white       30           40
 .      others      30           30
;
run;
proc transpose data=have out=want;
by var1 var2 notsorted;
var smoker nonsmoker;
run;

&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Nov 2016 07:45:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-from-a-multi-way-table/m-p/310307#M66917</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-11-09T07:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: reading data from a multi-way table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-from-a-multi-way-table/m-p/310309#M66918</link>
      <description>&lt;P&gt;Thanks so much ksharp!&lt;BR /&gt;&lt;BR /&gt;Is there any way I can do to rename the variable '_name_' in the transposed dataset which has the value of 'smoker' to a numerical variable 1, nonsmoker to 2?&lt;BR /&gt;&lt;BR /&gt;also, how can I renane the variable col1 in the transposed variable?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2016 08:39:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-from-a-multi-way-table/m-p/310309#M66918</guid>
      <dc:creator>joseph626</dc:creator>
      <dc:date>2016-11-09T08:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: reading data from a multi-way table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-from-a-multi-way-table/m-p/310311#M66920</link>
      <description>&lt;PRE&gt;

options validvarname=any;
data have;
input    var1 $ var2 $    '1'n '2'n;
cards;
male    white       10           20
 .      others      20           30
female  white       30           40
 .      others      30           30
;
run;
proc transpose data=have out=want(rename=(col1=value));
by var1 var2 notsorted;
var '1'n '2'n ;
run;

&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Nov 2016 08:43:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-from-a-multi-way-table/m-p/310311#M66920</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-11-09T08:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: reading data from a multi-way table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-from-a-multi-way-table/m-p/310312#M66921</link>
      <description>&lt;PRE&gt;


options validvarname=any;
data have;
input    var1 $ var2 $    '1'n '2'n;
cards;
male    white       10           20
 .      others      20           30
female  white       30           40
 .      others      30           30
;
run;
proc transpose data=have name=smoke out=want(rename=(col1=value));
by var1 var2 notsorted;
var '1'n '2'n ;
run;

&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Nov 2016 09:01:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-from-a-multi-way-table/m-p/310312#M66921</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-11-09T09:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: reading data from a multi-way table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-from-a-multi-way-table/m-p/310492#M66991</link>
      <description>THANKS again!!!</description>
      <pubDate>Wed, 09 Nov 2016 19:10:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-from-a-multi-way-table/m-p/310492#M66991</guid>
      <dc:creator>joseph626</dc:creator>
      <dc:date>2016-11-09T19:10:29Z</dc:date>
    </item>
  </channel>
</rss>

