<?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: How can i return the output datasets from Proc Tabulate procedure back to the orginal tables??? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-can-i-return-the-output-datasets-from-Proc-Tabulate/m-p/667121#M79049</link>
    <description>&lt;P&gt;hi there, thank you for your quick reply. I found the transpose procedure doesn't work when the categorical variable have more than 2 different types.&lt;/P&gt;
&lt;P&gt;data class; set sashelp.class; if height&amp;lt;=55 then h='01 L'; else if height&amp;lt;=60 then h='02 M'; else h='03 H'; run;&lt;/P&gt;
&lt;P&gt;proc tabulate data=class out=temp; class age sex h; table age='',h=''*N=''; run;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.jpg" style="width: 281px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46930i87EE4B7AD2B8E9C0/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.jpg" alt="1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;proc transpose data=temp out=want (drop=_:); var N; by age; id h; run; proc print data=want;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.jpg" style="width: 213px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46931i4FD65DDEF2B1E411/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.jpg" alt="2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jul 2020 08:38:33 GMT</pubDate>
    <dc:creator>EC189QRW</dc:creator>
    <dc:date>2020-07-06T08:38:33Z</dc:date>
    <item>
      <title>How can i return the output datasets from Proc Tabulate procedure back to the orginal tables???</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-i-return-the-output-datasets-from-Proc-Tabulate/m-p/667113#M79047</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;
&lt;P&gt;I've already created a Temp dataset from proc tabulate procedure show as follows, Can i use any Proc procedures to return the Temp datasets back into the original table created by Proc tabulates?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any advice to do it?&lt;/P&gt;
&lt;P&gt;Thank you all.&lt;/P&gt;
&lt;P&gt;Eric&lt;/P&gt;
&lt;P&gt;step1:&lt;/P&gt;
&lt;P&gt;proc tabulate data=sashelp.class out=temp;&lt;BR /&gt;class age sex;&lt;BR /&gt;table age='',sex=''*N='';&lt;BR /&gt;run;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;temp datasets looks like this&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="temp.jpg" style="width: 694px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46928iF5B9BA7B01A6E8FC/image-size/large?v=v2&amp;amp;px=999" role="button" title="temp.jpg" alt="temp.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;step2:&lt;/P&gt;
&lt;P&gt;proc XXX data=temp;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I am looking for the results like this&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="target.jpg" style="width: 238px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46929iB505C68275BCEC36/image-size/large?v=v2&amp;amp;px=999" role="button" title="target.jpg" alt="target.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 06:54:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-i-return-the-output-datasets-from-Proc-Tabulate/m-p/667113#M79047</guid>
      <dc:creator>EC189QRW</dc:creator>
      <dc:date>2020-07-06T06:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can i return the output datasets from Proc Tabulate procedure back to the orginal tables???</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-i-return-the-output-datasets-from-Proc-Tabulate/m-p/667115#M79048</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60851"&gt;@EC189QRW&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try PROC TABULATE:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=temp out=want (drop=_:);
	var N;
	by age;
	id sex;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NB: you could also directly use a PROC REPORT:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=sashelp.class out=want;
	column age sex;
	define age / group '';
	define sex / across '';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 07:07:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-i-return-the-output-datasets-from-Proc-Tabulate/m-p/667115#M79048</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-07-06T07:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: How can i return the output datasets from Proc Tabulate procedure back to the orginal tables???</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-i-return-the-output-datasets-from-Proc-Tabulate/m-p/667121#M79049</link>
      <description>&lt;P&gt;hi there, thank you for your quick reply. I found the transpose procedure doesn't work when the categorical variable have more than 2 different types.&lt;/P&gt;
&lt;P&gt;data class; set sashelp.class; if height&amp;lt;=55 then h='01 L'; else if height&amp;lt;=60 then h='02 M'; else h='03 H'; run;&lt;/P&gt;
&lt;P&gt;proc tabulate data=class out=temp; class age sex h; table age='',h=''*N=''; run;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.jpg" style="width: 281px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46930i87EE4B7AD2B8E9C0/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.jpg" alt="1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;proc transpose data=temp out=want (drop=_:); var N; by age; id h; run; proc print data=want;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.jpg" style="width: 213px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46931i4FD65DDEF2B1E411/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.jpg" alt="2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 08:38:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-i-return-the-output-datasets-from-Proc-Tabulate/m-p/667121#M79049</guid>
      <dc:creator>EC189QRW</dc:creator>
      <dc:date>2020-07-06T08:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: How can i return the output datasets from Proc Tabulate procedure back to the orginal tables???</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-i-return-the-output-datasets-from-Proc-Tabulate/m-p/667124#M79050</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60851"&gt;@EC189QRW&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you pease post your log?&lt;/P&gt;
&lt;P&gt;Here is what I get when I run the code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
	set sashelp.class;

	if height&amp;lt;=55 then
		h='01 L';
	else if height&amp;lt;=60 then
		h='02 M';
	else
		h='03 H';
run;

proc tabulate data=class out=temp;
	class age sex h;
	table age='', h=''*N='';
run;

proc transpose data=temp out=want (drop=_:);
	var N;
	id h;
	by age;
run;

proc print data=want;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture d’écran 2020-07-06 à 10.47.17.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46932iF289DF8EB0108374/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture d’écran 2020-07-06 à 10.47.17.png" alt="Capture d’écran 2020-07-06 à 10.47.17.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; Best,&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 08:47:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-i-return-the-output-datasets-from-Proc-Tabulate/m-p/667124#M79050</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-07-06T08:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can i return the output datasets from Proc Tabulate procedure back to the orginal tables???</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-i-return-the-output-datasets-from-Proc-Tabulate/m-p/667132#M79051</link>
      <description>THANKS  A LOT!!</description>
      <pubDate>Mon, 06 Jul 2020 09:21:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-i-return-the-output-datasets-from-Proc-Tabulate/m-p/667132#M79051</guid>
      <dc:creator>EC189QRW</dc:creator>
      <dc:date>2020-07-06T09:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: How can i return the output datasets from Proc Tabulate procedure back to the orginal tables???</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-i-return-the-output-datasets-from-Proc-Tabulate/m-p/667133#M79052</link>
      <description>&lt;P&gt;You're very welcome&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60851"&gt;@EC189QRW&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 09:26:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-i-return-the-output-datasets-from-Proc-Tabulate/m-p/667133#M79052</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-07-06T09:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can i return the output datasets from Proc Tabulate procedure back to the orginal tables???</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-i-return-the-output-datasets-from-Proc-Tabulate/m-p/667136#M79053</link>
      <description>Here is the log . I think there might be some problem with my SAS base.&lt;BR /&gt;NOTE: Additional host information:&lt;BR /&gt;&lt;BR /&gt; X64_10PRO WIN 10.0.18362  Workstation&lt;BR /&gt;&lt;BR /&gt;NOTE: SAS initialization used:&lt;BR /&gt;      real time           2.57 seconds&lt;BR /&gt;      cpu time            1.99 seconds&lt;BR /&gt;&lt;BR /&gt;1    data class;&lt;BR /&gt;2        set sashelp.class;&lt;BR /&gt;3&lt;BR /&gt;4        if height&amp;lt;=55 then&lt;BR /&gt;5            h='01 L';&lt;BR /&gt;6        else if height&amp;lt;=60 then&lt;BR /&gt;7            h='02 M';&lt;BR /&gt;8        else&lt;BR /&gt;9            h='03 H';&lt;BR /&gt;10   run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 19 observations read from the data set SASHELP.CLASS.&lt;BR /&gt;NOTE: The data set WORK.CLASS has 19 observations and 6 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;      real time           0.04 seconds&lt;BR /&gt;      cpu time            0.03 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;11   proc tabulate data=class out=temp;&lt;BR /&gt;NOTE: Writing HTML Body file: sashtml.htm&lt;BR /&gt;12       class age sex h;&lt;BR /&gt;13       table age='', h=''*N='';&lt;BR /&gt;14   run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 19 observations read from the data set WORK.CLASS.&lt;BR /&gt;NOTE: The data set WORK.TEMP has 9 observations and 6 variables.&lt;BR /&gt;NOTE: PROCEDURE TABULATE used (Total process time):&lt;BR /&gt;      real time           0.64 seconds&lt;BR /&gt;      cpu time            0.43 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;15   proc transpose data=temp out=want (drop=_:);&lt;BR /&gt;16       var N;&lt;BR /&gt;17       id h;&lt;BR /&gt;18       by age;&lt;BR /&gt;19   run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 9 observations read from the data set WORK.TEMP.&lt;BR /&gt;NOTE: The data set WORK.WANT has 6 observations and 1 variables.&lt;BR /&gt;NOTE: PROCEDURE TRANSPOSE used (Total process time):&lt;BR /&gt;      real time           0.04 seconds&lt;BR /&gt;      cpu time            0.03 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;20   proc print data=want;&lt;BR /&gt;21&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 6 observations read from the data set WORK.WANT.&lt;BR /&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;BR /&gt;      real time           12.30 seconds&lt;BR /&gt;      cpu time            0.61 seconds&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Jul 2020 09:30:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-i-return-the-output-datasets-from-Proc-Tabulate/m-p/667136#M79053</guid>
      <dc:creator>EC189QRW</dc:creator>
      <dc:date>2020-07-06T09:30:44Z</dc:date>
    </item>
  </channel>
</rss>

