<?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: i want to creata a table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521501#M141507</link>
    <description>&lt;P&gt;There are&amp;nbsp;endless number of tables having thus "magic" rule.&lt;/P&gt;
&lt;P&gt;What is your input format and value to start with ?&lt;/P&gt;</description>
    <pubDate>Fri, 14 Dec 2018 15:33:12 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2018-12-14T15:33:12Z</dc:date>
    <item>
      <title>i want to creata a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521484#M141500</link>
      <description>&lt;P&gt;Hi all I intend to create table like this&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="0" border="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;c&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;c&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;where in&amp;nbsp; base we have a b and c and the values for a b c are given if we check them horizontally or vertically it should show the same value&amp;nbsp; like &lt;STRONG&gt;a&lt;/STRONG&gt; should be 1 and for a and b it should be 2 even in column and row .Please advise how to do it. Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Dec 2018 18:33:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521484#M141500</guid>
      <dc:creator>Aayushi_17</dc:creator>
      <dc:date>2018-12-14T18:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: i want to creata a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521501#M141507</link>
      <description>&lt;P&gt;There are&amp;nbsp;endless number of tables having thus "magic" rule.&lt;/P&gt;
&lt;P&gt;What is your input format and value to start with ?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Dec 2018 15:33:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521501#M141507</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-12-14T15:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: i want to creata a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521507#M141508</link>
      <description>&lt;P&gt;my input format is a= 1, b=2, c=3&lt;/P&gt;</description>
      <pubDate>Fri, 14 Dec 2018 18:35:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521507#M141508</guid>
      <dc:creator>Aayushi_17</dc:creator>
      <dc:date>2018-12-14T18:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: i want to creata a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521526#M141514</link>
      <description>&lt;P&gt;In your posted sample there is cc=6.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it part of the input? or should it be calculated by any formula?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What about bc &amp;amp;cb ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you create your input using data step like:&lt;/P&gt;
&lt;P&gt;data start;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; infile cards;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;input names $2, value;&lt;/P&gt;
&lt;P&gt;cards;&lt;/P&gt;
&lt;P&gt;aa 1&lt;/P&gt;
&lt;P&gt;ab 2&lt;/P&gt;
&lt;P&gt;ac 2&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Dec 2018 16:10:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521526#M141514</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-12-14T16:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: i want to creata a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521527#M141515</link>
      <description>no thats the part of the input</description>
      <pubDate>Fri, 14 Dec 2018 16:02:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521527#M141515</guid>
      <dc:creator>Aayushi_17</dc:creator>
      <dc:date>2018-12-14T16:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: i want to creata a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521531#M141519</link>
      <description>&lt;P&gt;what is the format value for DD and for EE?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Dec 2018 16:06:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521531#M141519</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-12-14T16:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: i want to creata a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521600#M141542</link>
      <description>if a= 1 b = 2 c= 3 then if i make a table it for a and b it should be a multiple of both a and b&lt;BR /&gt;the value for d will be 4 and e will be 5</description>
      <pubDate>Fri, 14 Dec 2018 18:37:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521600#M141542</guid>
      <dc:creator>Aayushi_17</dc:creator>
      <dc:date>2018-12-14T18:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: i want to creata a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521672#M141558</link>
      <description>&lt;P&gt;maybe this does what you need? After running, check table _final for validity.&amp;nbsp; Add more vars in the first step's instream card file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _first ;
length str $32760 ;
retain str ''  ;
infile datalines eof = eof  ;
do;
	input x $ value ;
	str = catx(',' , str, strip(x) || ' * value as ' || strip(x) ) ;
	drop str ;
	output;
end ;
eof: 
call symputx('cols', str) ;
datalines;
a 1
b 2
c 3
;

%put *** &amp;amp;=cols ;

proc transpose data=_first out = _t ;
var  value;
id x ;
run ;

proc sql noprint ;
 create table _all as
 select x.*,y.*
 from _first x , _t y
 ;
quit ;

proc sql noprint ;
	create table _final as
	select x , &amp;amp;cols
	from _all ;
quit ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Dec 2018 22:23:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521672#M141558</guid>
      <dc:creator>johnsville</dc:creator>
      <dc:date>2018-12-14T22:23:07Z</dc:date>
    </item>
    <item>
      <title>Re: i want to creata a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521702#M141568</link>
      <description>&lt;P&gt;On second looking, ignoring names, your table is:&lt;/P&gt;
&lt;PRE&gt;1*1=1   1*2=2   1*3=3
2*1=2   2*2=4   2*3=6
3*1=3   3*2=6   3*3=9&lt;/PRE&gt;
&lt;P&gt;based on this formula you can create any dimension table by next tested code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro magic(names);
   %let n = %sysfunc(countw(&amp;amp;names));
   
   data want(keep=&amp;amp;names);
      array ch $ c1-c&amp;amp;n;
      array va   {*} v1-v&amp;amp;n;
      
      do i=1 to &amp;amp;n;
         ch(i) = scan("&amp;amp;names",i);
         va(i) = i;
      end;
      
      do i=1 to &amp;amp;n-1;
	      %do i=1 %to &amp;amp;n;
	          %scan(&amp;amp;names, &amp;amp;i) =
	             %if &amp;amp;i=1 %then ch(i+1);
	             %else va(i)*(&amp;amp;i-1);
	             ;
	      %end;
	      output;
	  end;
   run;
%mend magic;
options mprint;
%magic(x a b c d);
          
               &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Dec 2018 05:27:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521702#M141568</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-12-15T05:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: i want to creata a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521774#M141589</link>
      <description>thank you so much</description>
      <pubDate>Sun, 16 Dec 2018 06:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-creata-a-table/m-p/521774#M141589</guid>
      <dc:creator>Aayushi_17</dc:creator>
      <dc:date>2018-12-16T06:06:24Z</dc:date>
    </item>
  </channel>
</rss>

