<?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: SAS EG transpose statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-EG-transpose-statement/m-p/872426#M344689</link>
    <description>&lt;P&gt;If you want the&amp;nbsp; variables named using the ID variable to appear in any specific order you &lt;STRONG&gt;might&lt;/STRONG&gt; be able to do that by using&lt;/P&gt;
&lt;PRE&gt;PROC SORT
	DATA=WORK.QUERY_FOR_APPEND_TABLE_0000(KEEP="SUM_of_Count(Distinct(AKA_CIN))"n SVC_FROM_DT_MM Age_Group)
	OUT=WORK.SORTTempTableSorted
	;
	BY DESCENDING Age_Group Svc_from_dt_mm;
RUN;&lt;/PRE&gt;
&lt;P&gt;Maybe. If the ID variable does not have all the same levels for every BY&amp;nbsp; value they will not be created in the order that that they appear in each BY variable group. Since you didn't provide any sort order for the ID variable they are haphazard within the values of the Age_group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BUT the question is "why bother?"&amp;nbsp; Any output that you create for people to read can specify the order of values and SAS doesn't care about the order of the variables in the data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have to say you are willing to deal with way uglier variable names then I would touch.&lt;/P&gt;</description>
    <pubDate>Thu, 27 Apr 2023 02:10:25 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-04-27T02:10:25Z</dc:date>
    <item>
      <title>SAS EG transpose statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-EG-transpose-statement/m-p/872411#M344679</link>
      <description>&lt;P&gt;Could you please explain me how to modify the code below to use my own list of column names? SAS EG generated&amp;nbsp;the codes below. My column names are currently a jumble of numbers that aren't even in order. I wouldn't have to change their names if I could just put them in order. I'd want to see how this might be resolved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC SORT
	DATA=WORK.QUERY_FOR_APPEND_TABLE_0000(KEEP="SUM_of_Count(Distinct(AKA_CIN))"n SVC_FROM_DT_MM Age_Group)
	OUT=WORK.SORTTempTableSorted
	;
	BY DESCENDING Age_Group;
RUN;
PROC TRANSPOSE DATA=WORK.SORTTempTableSorted
	OUT=WORK.TRNSTRANSPOSED_0004(LABEL="Transposed WORK.QUERY_FOR_APPEND_TABLE_0000")
	NAME=Source
	LABEL=Label
;
	BY DESCENDING Age_Group;
	ID SVC_FROM_DT_MM;
	VAR "SUM_of_Count(Distinct(AKA_CIN))"n;&lt;/PRE&gt;&lt;P&gt;This is what I am working on:&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="ralizadeh_0-1682548221506.png" style="width: 1166px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/83272i2B0952122653EE01/image-dimensions/1166x228?v=v2" width="1166" height="228" role="button" title="ralizadeh_0-1682548221506.png" alt="ralizadeh_0-1682548221506.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 22:35:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-EG-transpose-statement/m-p/872411#M344679</guid>
      <dc:creator>ralizadeh</dc:creator>
      <dc:date>2023-04-26T22:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EG transpose statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-EG-transpose-statement/m-p/872426#M344689</link>
      <description>&lt;P&gt;If you want the&amp;nbsp; variables named using the ID variable to appear in any specific order you &lt;STRONG&gt;might&lt;/STRONG&gt; be able to do that by using&lt;/P&gt;
&lt;PRE&gt;PROC SORT
	DATA=WORK.QUERY_FOR_APPEND_TABLE_0000(KEEP="SUM_of_Count(Distinct(AKA_CIN))"n SVC_FROM_DT_MM Age_Group)
	OUT=WORK.SORTTempTableSorted
	;
	BY DESCENDING Age_Group Svc_from_dt_mm;
RUN;&lt;/PRE&gt;
&lt;P&gt;Maybe. If the ID variable does not have all the same levels for every BY&amp;nbsp; value they will not be created in the order that that they appear in each BY variable group. Since you didn't provide any sort order for the ID variable they are haphazard within the values of the Age_group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BUT the question is "why bother?"&amp;nbsp; Any output that you create for people to read can specify the order of values and SAS doesn't care about the order of the variables in the data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have to say you are willing to deal with way uglier variable names then I would touch.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2023 02:10:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-EG-transpose-statement/m-p/872426#M344689</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-04-27T02:10:25Z</dc:date>
    </item>
  </channel>
</rss>

