<?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: Shift table transpose in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Shift-table-transpose/m-p/900519#M355896</link>
    <description>&lt;P&gt;You can use the &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Demographic-Table-and-Subgroup-Summary-Macro-TABLEN/ta-p/634030" target="_self"&gt;%TABLEN macro&lt;/A&gt; to produce such a table.&lt;/P&gt;</description>
    <pubDate>Sun, 29 Oct 2023 18:32:28 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-10-29T18:32:28Z</dc:date>
    <item>
      <title>Shift table transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shift-table-transpose/m-p/900342#M355828</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am creating a shift table using below code. I have provided the data below. I am transposing 2 times, first transpose is for basecat1 values and my final transpose is for ANAGR2N. But my final transpose if not working I am getting 0 records. Is there any way we can do it in only one transpose or do I need to use different procedure to get counts? I am not sure where I am wrong. Can you please suggest. My expected output is below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Adi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="anyalamadugu_0-1698433545270.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/89171iBE4EA9646581BD42/image-size/large?v=v2&amp;amp;px=999" role="button" title="anyalamadugu_0-1698433545270.png" alt="anyalamadugu_0-1698433545270.png" /&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;data have;&lt;BR /&gt;infile datalines dsd truncover;&lt;BR /&gt;input USUBJID:$30. ANAGR2N:32. PARAM:$200. PARAMCD:$8. AVALCAT1:$200. AVISIT:$200. AVISITN:32. avaln:32. BASECAT1:$200. basen:32.;&lt;BR /&gt;datalines4;&lt;BR /&gt;TAK-935-3001-09011-105,1,Mobility,EQ5D0201,No problems,V1,1,1,Missing,6&lt;BR /&gt;TAK-935-3001-63004-105,1,Mobility,EQ5D0201,No problems,V1,1,1,Missing,6&lt;BR /&gt;TAK-935-3001-09011-105,1,Mobility,EQ5D0201,Total,V1,1,9,Missing,6&lt;BR /&gt;TAK-935-3001-63004-105,1,Mobility,EQ5D0201,Total,V1,1,9,Missing,6&lt;BR /&gt;TAK-935-3001-09011-105,1,Mobility,EQ5D0201,No problems,V1,1,1,Total,9&lt;BR /&gt;TAK-935-3001-63004-105,1,Mobility,EQ5D0201,No problems,V1,1,1,Total,9&lt;BR /&gt;TAK-935-3001-09011-105,1,Mobility,EQ5D0201,Total,V1,1,9,Total,9&lt;BR /&gt;TAK-935-3001-63004-105,1,Mobility,EQ5D0201,Total,V1,1,9,Total,9&lt;BR /&gt;TAK-935-3002-02001-202,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-04001-202,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-04003-202,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-04003-203,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-07001-201,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-07001-204,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-09001-203,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-09001-204,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-09002-203,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-09002-204,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-09003-203,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-09003-206,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;;;;;&lt;BR /&gt;run;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;PRE&gt;&lt;CODE class=""&gt;** Get count;
proc sort data=adqseq1_fin; by paramcd param avisitn avisit anagr2n basen avaln; run;
proc freq data=adqseq1_fin;
	by paramcd param avisitn avisit anagr2n basen avaln;
	tables avalcat1*basecat1 / out=step1;
run;

** Transpose basecat1;
proc sort data=step1; by paramcd param avisitn avisit avaln avalcat1 anagr2n; run; 
proc transpose data=step1(where=(basen ne .)) out=step2(drop=_name_ _label_) prefix=_;
	id basen;
	var count;
	by paramcd param avisitn avisit avaln avalcat1 anagr2n;
run;

** Transpose ANAGR2N;
data step2_;
	set step2;
	if anagr2n=1 then do;
		_11=_1;
		_12=_2;
		_13=_3;
		_14=_4;
		_15=_5;
		_16=_6;
		_19=_9;
	end;
	if anagr2n=2 then do;
		_21=_1;
		_22=_2;
		_23=_3;
		_24=_4;
		_25=_5;
		_26=_6;
		_29=_9;
	end;
	if anagr2n=3 then do;
		_31=_1;
		_32=_2;
		_33=_3;
		_34=_4;
		_35=_5;
		_36=_6;
		_39=_9;
	end;
	drop _1 _2 _3 _4 _5 _6 _9;
run;

** Final traspose for ANAGR2N;
proc sort data=step2_; by paramcd param avisitn avisit avaln avalcat1 _:; run;
proc transpose data=step2_(where=(anagr2n ne .)) out=step3(drop=_name_) prefix=_;
	id anagr2n;
	by paramcd param avisitn avisit avaln avalcat1 _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 27 Oct 2023 19:06:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shift-table-transpose/m-p/900342#M355828</guid>
      <dc:creator>chinna0369</dc:creator>
      <dc:date>2023-10-27T19:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: Shift table transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shift-table-transpose/m-p/900348#M355831</link>
      <description>&lt;P&gt;Please provide data as working SAS data step code (&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;examples and instructions&lt;/A&gt;), as you did in &lt;A href="https://communities.sas.com/t5/SAS-Programming/Add-missing-grades-to-show-0-counts/td-p/711570" target="_self"&gt;earlier threads&lt;/A&gt;. We cannot work with data in screen captures. We cannot work with data in Excel. It must be in the form stated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When something doesn't work, please provide us with the LOG for your code. We need to see the ENTIRE log for the step that has the error (the ENTIRE log for the step that has the error, not just the error messages). Copy the log as text and paste it into the window that appears when you click on the &amp;lt;/&amp;gt; icon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66123iA4EF494F9CA0F6EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" alt="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 17:54:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shift-table-transpose/m-p/900348#M355831</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-10-27T17:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: Shift table transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shift-table-transpose/m-p/900381#M355835</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Please find the data below.&lt;BR /&gt;&lt;BR /&gt;data have;&lt;BR /&gt;infile datalines dsd truncover;&lt;BR /&gt;input USUBJID:$30. ANAGR2N:32. PARAM:$200. PARAMCD:$8. AVALCAT1:$200. AVISIT:$200. AVISITN:32. avaln:32. BASECAT1:$200. basen:32.;&lt;BR /&gt;datalines4;&lt;BR /&gt;TAK-935-3001-09011-105,1,Mobility,EQ5D0201,No problems,V1,1,1,Missing,6&lt;BR /&gt;TAK-935-3001-63004-105,1,Mobility,EQ5D0201,No problems,V1,1,1,Missing,6&lt;BR /&gt;TAK-935-3001-09011-105,1,Mobility,EQ5D0201,Total,V1,1,9,Missing,6&lt;BR /&gt;TAK-935-3001-63004-105,1,Mobility,EQ5D0201,Total,V1,1,9,Missing,6&lt;BR /&gt;TAK-935-3001-09011-105,1,Mobility,EQ5D0201,No problems,V1,1,1,Total,9&lt;BR /&gt;TAK-935-3001-63004-105,1,Mobility,EQ5D0201,No problems,V1,1,1,Total,9&lt;BR /&gt;TAK-935-3001-09011-105,1,Mobility,EQ5D0201,Total,V1,1,9,Total,9&lt;BR /&gt;TAK-935-3001-63004-105,1,Mobility,EQ5D0201,Total,V1,1,9,Total,9&lt;BR /&gt;TAK-935-3002-02001-202,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-04001-202,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-04003-202,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-04003-203,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-07001-201,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-07001-204,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-09001-203,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-09001-204,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-09002-203,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-09002-204,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-09003-203,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;TAK-935-3002-09003-206,2,Mobility,EQ5D0201,No problems,V1,1,1,No problems,1&lt;BR /&gt;;;;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;And here is the log for my above code, there is no error, I am just getting 0 records.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt;INFO: Character variables have defaulted to a length of 200 at the places given by: (Line):(Column). Truncation can result.&lt;BR /&gt;40:1 RC&lt;BR /&gt;72&lt;BR /&gt;73 data adqseq1_fin;&lt;BR /&gt;74 set adqseq1_fin3;&lt;BR /&gt;75 output;&lt;BR /&gt;76 anagr2="Total";&lt;BR /&gt;77 anagr2n=3;&lt;BR /&gt;78 output;&lt;BR /&gt;79 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 7,680 observations read from the data set WORK.ADQSEQ1_FIN3.&lt;BR /&gt;NOTE: The data set WORK.ADQSEQ1_FIN has 15,360 observations and 17 variables.&lt;BR /&gt;NOTE: Compressing data set WORK.ADQSEQ1_FIN decreased size by 87.01 percent.&lt;BR /&gt;Compressed is 40 pages; un-compressed would require 308 pages.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.02 seconds&lt;BR /&gt;user cpu time 0.02 seconds&lt;BR /&gt;system cpu time 0.00 seconds&lt;BR /&gt;memory 997.03k&lt;BR /&gt;OS Memory 55204.00k&lt;BR /&gt;Timestamp 10/27/2023 06:17:42 PM&lt;BR /&gt;Step Count 861 Switch Count 5&lt;BR /&gt;Page Faults 0&lt;BR /&gt;Page Reclaims 19&lt;BR /&gt;Page Swaps 0&lt;BR /&gt;Voluntary Context Switches 19&lt;BR /&gt;Involuntary Context Switches 1&lt;BR /&gt;Block Input Operations 0&lt;BR /&gt;Block Output Operations 5128&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;80 proc sort nodupkey; by studyid usubjid paramcd avisitn adt anagr2n avaln basen; run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 15,360 observations read from the data set WORK.ADQSEQ1_FIN.&lt;BR /&gt;NOTE: SAS sort was used.&lt;BR /&gt;NOTE: 0 observations with duplicate key values were deleted.&lt;BR /&gt;NOTE: The data set WORK.ADQSEQ1_FIN has 15,360 observations and 17 variables.&lt;BR /&gt;NOTE: Compressing data set WORK.ADQSEQ1_FIN decreased size by 87.01 percent.&lt;BR /&gt;Compressed is 40 pages; un-compressed would require 308 pages.&lt;BR /&gt;NOTE: PROCEDURE SORT used (Total process time):&lt;BR /&gt;real time 0.04 seconds&lt;BR /&gt;user cpu time 0.03 seconds&lt;BR /&gt;system cpu time 0.02 seconds&lt;BR /&gt;memory 25824.18k&lt;BR /&gt;OS Memory 79884.00k&lt;BR /&gt;Timestamp 10/27/2023 06:17:42 PM&lt;BR /&gt;Step Count 862 Switch Count 5&lt;BR /&gt;Page Faults 0&lt;BR /&gt;Page Reclaims 6004&lt;BR /&gt;Page Swaps 0&lt;BR /&gt;Voluntary Context Switches 17&lt;BR /&gt;Involuntary Context Switches 0&lt;BR /&gt;Block Input Operations 0&lt;BR /&gt;Block Output Operations 5128&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;81&lt;BR /&gt;82 ** Get count;&lt;BR /&gt;83 proc sort data=adqseq1_fin; by paramcd param avisitn avisit anagr2n basen avaln; run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 15,360 observations read from the data set WORK.ADQSEQ1_FIN.&lt;BR /&gt;NOTE: SAS sort was used.&lt;BR /&gt;NOTE: The data set WORK.ADQSEQ1_FIN has 15,360 observations and 17 variables.&lt;BR /&gt;NOTE: Compressing data set WORK.ADQSEQ1_FIN decreased size by 87.01 percent.&lt;BR /&gt;Compressed is 40 pages; un-compressed would require 308 pages.&lt;BR /&gt;NOTE: PROCEDURE SORT used (Total process time):&lt;BR /&gt;real time 0.05 seconds&lt;BR /&gt;user cpu time 0.03 seconds&lt;BR /&gt;system cpu time 0.02 seconds&lt;BR /&gt;memory 28130.15k&lt;BR /&gt;OS Memory 81940.00k&lt;BR /&gt;Timestamp 10/27/2023 06:17:42 PM&lt;BR /&gt;Step Count 863 Switch Count 5&lt;BR /&gt;Page Faults 0&lt;BR /&gt;Page Reclaims 6561&lt;BR /&gt;Page Swaps 0&lt;BR /&gt;Voluntary Context Switches 18&lt;BR /&gt;Involuntary Context Switches 0&lt;BR /&gt;Block Input Operations 0&lt;BR /&gt;Block Output Operations 5128&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;84 proc freq data=adqseq1_fin;&lt;BR /&gt;85 by paramcd param avisitn avisit anagr2n basen avaln;&lt;BR /&gt;86 tables avalcat1*basecat1 / out=step1;&lt;BR /&gt;87 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: BY line has been truncated at least once.&lt;BR /&gt;NOTE: The above message was for the following BY group:&lt;BR /&gt;Parameter Code=EQ5D0203 Parameter=Usual Activities Analysis Visit (N)=5 Analysis Visit=V5 Week 26 Analysis Group 2 (N)=1&lt;BR /&gt;basen=6&lt;BR /&gt;NOTE: There were 15,360 observations read from the data set WORK.ADQSEQ1_FIN.&lt;BR /&gt;NOTE: The data set WORK.STEP1 has 979 observations and 11 variables.&lt;BR /&gt;NOTE: Compressing data set WORK.STEP1 decreased size by 76.92 percent.&lt;BR /&gt;Compressed is 3 pages; un-compressed would require 13 pages.&lt;BR /&gt;NOTE: PROCEDURE FREQ used (Total process time):&lt;BR /&gt;real time 11.45 seconds&lt;BR /&gt;user cpu time 11.17 seconds&lt;BR /&gt;system cpu time 0.08 seconds&lt;BR /&gt;memory 20049.71k&lt;BR /&gt;OS Memory 69828.00k&lt;BR /&gt;Timestamp 10/27/2023 06:17:54 PM&lt;BR /&gt;Step Count 864 Switch Count 240&lt;BR /&gt;Page Faults 0&lt;BR /&gt;Page Reclaims 3580&lt;BR /&gt;Page Swaps 0&lt;BR /&gt;Voluntary Context Switches 720&lt;BR /&gt;Involuntary Context Switches 34&lt;BR /&gt;Block Input Operations 1488&lt;BR /&gt;Block Output Operations 7944&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;88&lt;BR /&gt;89 ** Transpose basecat1;&lt;BR /&gt;90 proc sort data=step1; by paramcd param avisitn avisit avaln avalcat1 anagr2n; run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 979 observations read from the data set WORK.STEP1.&lt;BR /&gt;NOTE: SAS sort was used.&lt;BR /&gt;NOTE: The data set WORK.STEP1 has 979 observations and 11 variables.&lt;BR /&gt;NOTE: Compressing data set WORK.STEP1 decreased size by 76.92 percent.&lt;BR /&gt;Compressed is 3 pages; un-compressed would require 13 pages.&lt;BR /&gt;NOTE: PROCEDURE SORT used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;user cpu time 0.01 seconds&lt;BR /&gt;system cpu time 0.00 seconds&lt;BR /&gt;memory 2875.75k&lt;BR /&gt;OS Memory 68820.00k&lt;BR /&gt;Timestamp 10/27/2023 06:17:54 PM&lt;BR /&gt;Step Count 865 Switch Count 11&lt;BR /&gt;Page Faults 0&lt;BR /&gt;Page Reclaims 424&lt;BR /&gt;Page Swaps 0&lt;BR /&gt;Voluntary Context Switches 42&lt;BR /&gt;Involuntary Context Switches 0&lt;BR /&gt;Block Input Operations 0&lt;BR /&gt;Block Output Operations 392&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;91 proc transpose data=step1(where=(basen ne .)) out=step2(drop=_name_ _label_) prefix=_;&lt;BR /&gt;92 id basen;&lt;BR /&gt;93 var count;&lt;BR /&gt;94 by paramcd param avisitn avisit avaln avalcat1 anagr2n;&lt;BR /&gt;95 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 781 observations read from the data set WORK.STEP1.&lt;BR /&gt;WHERE basen not = .;&lt;BR /&gt;NOTE: The data set WORK.STEP2 has 251 observations and 14 variables.&lt;BR /&gt;NOTE: Compressing data set WORK.STEP2 decreased size by 33.33 percent.&lt;BR /&gt;Compressed is 2 pages; un-compressed would require 3 pages.&lt;BR /&gt;NOTE: PROCEDURE TRANSPOSE used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;user cpu time 0.01 seconds&lt;BR /&gt;system cpu time 0.00 seconds&lt;BR /&gt;memory 2837.59k&lt;BR /&gt;OS Memory 68552.00k&lt;BR /&gt;Timestamp 10/27/2023 06:17:54 PM&lt;BR /&gt;Step Count 866 Switch Count 19&lt;BR /&gt;Page Faults 0&lt;BR /&gt;Page Reclaims 149&lt;BR /&gt;Page Swaps 0&lt;BR /&gt;Voluntary Context Switches 72&lt;BR /&gt;Involuntary Context Switches 0&lt;BR /&gt;Block Input Operations 0&lt;BR /&gt;Block Output Operations 408&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;96&lt;BR /&gt;97 ** Transpose ANAGR2N;&lt;BR /&gt;98 data step2_;&lt;BR /&gt;99 set step2;&lt;BR /&gt;100 if anagr2n=1 then do;&lt;BR /&gt;101 _11=_1;&lt;BR /&gt;102 _12=_2;&lt;BR /&gt;103 _13=_3;&lt;BR /&gt;104 _14=_4;&lt;BR /&gt;105 _15=_5;&lt;BR /&gt;106 _16=_6;&lt;BR /&gt;107 _19=_9;&lt;BR /&gt;108 end;&lt;BR /&gt;109 if anagr2n=2 then do;&lt;BR /&gt;110 _21=_1;&lt;BR /&gt;111 _22=_2;&lt;BR /&gt;112 _23=_3;&lt;BR /&gt;113 _24=_4;&lt;BR /&gt;114 _25=_5;&lt;BR /&gt;115 _26=_6;&lt;BR /&gt;116 _29=_9;&lt;BR /&gt;117 end;&lt;BR /&gt;118 if anagr2n=3 then do;&lt;BR /&gt;119 _31=_1;&lt;BR /&gt;120 _32=_2;&lt;BR /&gt;121 _33=_3;&lt;BR /&gt;122 _34=_4;&lt;BR /&gt;123 _35=_5;&lt;BR /&gt;124 _36=_6;&lt;BR /&gt;125 _39=_9;&lt;BR /&gt;126 end;&lt;BR /&gt;127 drop _1 _2 _3 _4 _5 _6 _9;&lt;BR /&gt;128 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 251 observations read from the data set WORK.STEP2.&lt;BR /&gt;NOTE: The data set WORK.STEP2_ has 251 observations and 28 variables.&lt;BR /&gt;NOTE: Compressing data set WORK.STEP2_ decreased size by 50.00 percent.&lt;BR /&gt;Compressed is 2 pages; un-compressed would require 4 pages.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;user cpu time 0.00 seconds&lt;BR /&gt;system cpu time 0.00 seconds&lt;BR /&gt;memory 898.81k&lt;BR /&gt;OS Memory 67012.00k&lt;BR /&gt;Timestamp 10/27/2023 06:17:54 PM&lt;BR /&gt;Step Count 867 Switch Count 4&lt;BR /&gt;Page Faults 0&lt;BR /&gt;Page Reclaims 62&lt;BR /&gt;Page Swaps 0&lt;BR /&gt;Voluntary Context Switches 25&lt;BR /&gt;Involuntary Context Switches 0&lt;BR /&gt;Block Input Operations 0&lt;BR /&gt;Block Output Operations 264&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;129&lt;BR /&gt;130 ** Final traspose for ANAGR2N;&lt;BR /&gt;131 proc sort data=step2_; by paramcd param avisitn avisit avaln avalcat1 _:; run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 251 observations read from the data set WORK.STEP2_.&lt;BR /&gt;NOTE: SAS sort was used.&lt;BR /&gt;NOTE: The data set WORK.STEP2_ has 251 observations and 28 variables.&lt;BR /&gt;NOTE: Compressing data set WORK.STEP2_ decreased size by 50.00 percent.&lt;BR /&gt;Compressed is 2 pages; un-compressed would require 4 pages.&lt;BR /&gt;NOTE: PROCEDURE SORT used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;user cpu time 0.00 seconds&lt;BR /&gt;system cpu time 0.01 seconds&lt;BR /&gt;memory 1821.68k&lt;BR /&gt;OS Memory 68048.00k&lt;BR /&gt;Timestamp 10/27/2023 06:17:54 PM&lt;BR /&gt;Step Count 868 Switch Count 4&lt;BR /&gt;Page Faults 0&lt;BR /&gt;Page Reclaims 123&lt;BR /&gt;Page Swaps 0&lt;BR /&gt;Voluntary Context Switches 21&lt;BR /&gt;Involuntary Context Switches 0&lt;BR /&gt;Block Input Operations 0&lt;BR /&gt;Block Output Operations 264&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;132 proc transpose data=step2_(where=(anagr2n ne .)) out=step3(drop=_name_) prefix=_;&lt;BR /&gt;133 id anagr2n;&lt;BR /&gt;134 by paramcd param avisitn avisit avaln avalcat1 _:;&lt;BR /&gt;135 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: No variables to transpose.&lt;BR /&gt;NOTE: There were 251 observations read from the data set WORK.STEP2_.&lt;BR /&gt;WHERE anagr2n not = .;&lt;BR /&gt;NOTE: The data set WORK.STEP3 has 0 observations and 30 variables.&lt;BR /&gt;NOTE: PROCEDURE TRANSPOSE used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;user cpu time 0.01 seconds&lt;BR /&gt;system cpu time 0.00 seconds&lt;BR /&gt;memory 1036.25k&lt;BR /&gt;OS Memory 67268.00k&lt;BR /&gt;Timestamp 10/27/2023 06:17:54 PM&lt;BR /&gt;Step Count 869 Switch Count 7&lt;BR /&gt;Page Faults 0&lt;BR /&gt;Page Reclaims 92&lt;BR /&gt;Page Swaps 0&lt;BR /&gt;Voluntary Context Switches 31&lt;BR /&gt;Involuntary Context Switches 0&lt;BR /&gt;Block Input Operations 0&lt;BR /&gt;Block Output Operations 272</description>
      <pubDate>Fri, 27 Oct 2023 18:19:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shift-table-transpose/m-p/900381#M355835</guid>
      <dc:creator>chinna0369</dc:creator>
      <dc:date>2023-10-27T18:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Shift table transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shift-table-transpose/m-p/900386#M355836</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068" target="_self"&gt;Maxim 2&lt;/A&gt;: Read the log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;132 proc transpose data=step2_(where=(anagr2n ne .)) out=step3(drop=_name_) prefix=_;
133 id anagr2n;
134 by paramcd param avisitn avisit avaln avalcat1 _:;
135 run;

&lt;FONT color="#FF0000"&gt;NOTE: No variables to transpose.&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can't do a transpose if there are no variables to transpose. Why are there no variables to transpose? Because you told PROC TRANSPOSE that every variable in the data set is either an ID variable for PROC TRANSPOSE, or it is a BY variable for PROC TRANSPOSE, and so there's no variables left to transpose.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 18:35:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shift-table-transpose/m-p/900386#M355836</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-10-27T18:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Shift table transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shift-table-transpose/m-p/900393#M355837</link>
      <description>&lt;P&gt;Can you show what the result is supposed to look like? Code that does not run or doesn't provide an output does not describe what the desired result may look&amp;nbsp; like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And are you sure that you need a data set? Sometime a report is more likely to generate output in a complex appearance.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 19:01:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shift-table-transpose/m-p/900393#M355837</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-10-27T19:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Shift table transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shift-table-transpose/m-p/900395#M355838</link>
      <description>I have added expected output now in my post. Thanks!</description>
      <pubDate>Fri, 27 Oct 2023 19:15:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shift-table-transpose/m-p/900395#M355838</guid>
      <dc:creator>chinna0369</dc:creator>
      <dc:date>2023-10-27T19:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: Shift table transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shift-table-transpose/m-p/900511#M355895</link>
      <description>&lt;P&gt;It appears to me that you can do most of this in PROC TABULATE, and I imagine all of it in PROC REPORT.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can offer a PROC TABULATE solution, but others will have to do the PROC REPORT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But first, you have instances of "Total" for BASECAT1 and AVALCAT1.&amp;nbsp; You haven't said what you want to do with them.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Oct 2023 18:27:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shift-table-transpose/m-p/900511#M355895</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2023-10-29T18:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: Shift table transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Shift-table-transpose/m-p/900519#M355896</link>
      <description>&lt;P&gt;You can use the &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Demographic-Table-and-Subgroup-Summary-Macro-TABLEN/ta-p/634030" target="_self"&gt;%TABLEN macro&lt;/A&gt; to produce such a table.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Oct 2023 18:32:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Shift-table-transpose/m-p/900519#M355896</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-10-29T18:32:28Z</dc:date>
    </item>
  </channel>
</rss>

