<?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 to work with unusual column names after transpose? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-work-with-unusual-column-names-after-transpose/m-p/582979#M165903</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/273559"&gt;@pensarchem&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;thanks you very much, Reeza, it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Total = sum(of '1--25'n --'&amp;gt;100'n);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it's certainly not ideal to use these kinds of headers, but they are informative..It's good to keep them in the headers, thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then don't use these kinds of headers. Sum the columns instead of summing the rows.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Aug 2019 20:03:45 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2019-08-21T20:03:45Z</dc:date>
    <item>
      <title>how to work with unusual column names after transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-work-with-unusual-column-names-after-transpose/m-p/582932#M165884</link>
      <description>&lt;P&gt;CALYEAR&amp;nbsp;prac_count&amp;nbsp;freq_range&lt;BR /&gt;2011&amp;nbsp;1181&amp;nbsp;1--25&lt;BR /&gt;2011&amp;nbsp;616&amp;nbsp;26--50&lt;BR /&gt;2011&amp;nbsp;411&amp;nbsp;51--75&lt;BR /&gt;2011&amp;nbsp;591&amp;nbsp;76--99&lt;BR /&gt;2011&amp;nbsp;64&amp;nbsp;=100&lt;BR /&gt;2011&amp;nbsp;240&amp;nbsp;&amp;gt;100&lt;BR /&gt;2012&amp;nbsp;1125&amp;nbsp;1--25&lt;BR /&gt;2012&amp;nbsp;606&amp;nbsp;26--50&lt;BR /&gt;2012&amp;nbsp;461&amp;nbsp;51--75&lt;BR /&gt;2012&amp;nbsp;555&amp;nbsp;76--99&lt;BR /&gt;2012&amp;nbsp;451&amp;nbsp;=100&lt;BR /&gt;2012&amp;nbsp;8&amp;nbsp;&amp;gt;100&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After transpose, the column headers become like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CALYEAR&amp;nbsp;1--25&amp;nbsp;26--50&amp;nbsp;51--75&amp;nbsp;76--99&amp;nbsp;=100&amp;nbsp;&amp;gt;100&lt;BR /&gt;2011&amp;nbsp;1181&amp;nbsp;616&amp;nbsp;411&amp;nbsp;591&amp;nbsp;64&amp;nbsp;240&lt;BR /&gt;2012&amp;nbsp;1125&amp;nbsp;606&amp;nbsp;461&amp;nbsp;555&amp;nbsp;451&amp;nbsp;8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's put &amp;gt;100 as example, it's char before transpose,&amp;nbsp; after type in sas, &amp;gt;100 becomes number.&amp;nbsp; Regardless, the format does not meet sas requirement anyway.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's say I want to sum along the row, how should I do? thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 18:25:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-work-with-unusual-column-names-after-transpose/m-p/582932#M165884</guid>
      <dc:creator>pensarchem</dc:creator>
      <dc:date>2019-08-21T18:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to work with unusual column names after transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-work-with-unusual-column-names-after-transpose/m-p/582935#M165886</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;After transpose, the column headers become like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CALYEAR&amp;nbsp;1--25&amp;nbsp;26--50&amp;nbsp;51--75&amp;nbsp;76--99&amp;nbsp;=100&amp;nbsp;&amp;gt;100&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2011&amp;nbsp;1181&amp;nbsp;616&amp;nbsp;411&amp;nbsp;591&amp;nbsp;64&amp;nbsp;240&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2012&amp;nbsp;1125&amp;nbsp;606&amp;nbsp;461&amp;nbsp;555&amp;nbsp;451&amp;nbsp;8&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;Actually, no they don't. Column names in SAS can't have a hyphen, equal sign or greater than (and a whole lot of other symbols also can't be in column names).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could actually run PROC TRANSPOSE on this data and see what the column names become.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Let's say I want to sum along the row, how should I do? thanks.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Simple: don't do the transpose, sum the column of pract_count, BY CALYEAR.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 18:34:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-work-with-unusual-column-names-after-transpose/m-p/582935#M165886</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-08-21T18:34:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to work with unusual column names after transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-work-with-unusual-column-names-after-transpose/m-p/582937#M165887</link>
      <description>&lt;P&gt;Hi Paige,&lt;/P&gt;&lt;P&gt;The column headers show as I copied after the transpose..If that's the case, I will think other method then, thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 18:38:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-work-with-unusual-column-names-after-transpose/m-p/582937#M165887</guid>
      <dc:creator>pensarchem</dc:creator>
      <dc:date>2019-08-21T18:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to work with unusual column names after transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-work-with-unusual-column-names-after-transpose/m-p/582939#M165888</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;The column headers show as I copied after the transpose.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Those might be the column LABELS, but not the column NAMES. I guess it depends where you are looking to see these column names. (Where do you see this?)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;If that's the case, I will think other method then, thanks.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The simpler method is to not trasnspose and then sum down the columns.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 18:43:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-work-with-unusual-column-names-after-transpose/m-p/582939#M165888</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-08-21T18:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to work with unusual column names after transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-work-with-unusual-column-names-after-transpose/m-p/582943#M165889</link>
      <description>&lt;P&gt;Run a proc contents to see the data set variable names and labels.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=sashelp.class; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For variable names with spaces and symbols you reference them using quotes around the name and an N after the quotation marks to indicate that it's a variable or dataset name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;keep 'GROUP 01'n 'GROUP 02'n;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can transpose and sum or you could sum directly in the original format if that's what you need. That's trivial using proc means.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I illustrate some options to calculate a mean and add it to a data set or to just summarize data here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/statgeek/SAS-Tutorials/blob/master/add_average_value_to_dataset.sas" target="_blank"&gt;https://github.com/statgeek/SAS-Tutorials/blob/master/add_average_value_to_dataset.sas&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/statgeek/SAS-Tutorials/blob/master/proc_means_basic.sas" target="_blank"&gt;https://github.com/statgeek/SAS-Tutorials/blob/master/proc_means_basic.sas&lt;/A&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would probably recommend creating a variable that you could use instead when transposing so you have cleaner variable names but that's your choice.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/273559"&gt;@pensarchem&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;CALYEAR&amp;nbsp;prac_count&amp;nbsp;freq_range&lt;BR /&gt;2011&amp;nbsp;1181&amp;nbsp;1--25&lt;BR /&gt;2011&amp;nbsp;616&amp;nbsp;26--50&lt;BR /&gt;2011&amp;nbsp;411&amp;nbsp;51--75&lt;BR /&gt;2011&amp;nbsp;591&amp;nbsp;76--99&lt;BR /&gt;2011&amp;nbsp;64&amp;nbsp;=100&lt;BR /&gt;2011&amp;nbsp;240&amp;nbsp;&amp;gt;100&lt;BR /&gt;2012&amp;nbsp;1125&amp;nbsp;1--25&lt;BR /&gt;2012&amp;nbsp;606&amp;nbsp;26--50&lt;BR /&gt;2012&amp;nbsp;461&amp;nbsp;51--75&lt;BR /&gt;2012&amp;nbsp;555&amp;nbsp;76--99&lt;BR /&gt;2012&amp;nbsp;451&amp;nbsp;=100&lt;BR /&gt;2012&amp;nbsp;8&amp;nbsp;&amp;gt;100&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After transpose, the column headers become like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CALYEAR&amp;nbsp;1--25&amp;nbsp;26--50&amp;nbsp;51--75&amp;nbsp;76--99&amp;nbsp;=100&amp;nbsp;&amp;gt;100&lt;BR /&gt;2011&amp;nbsp;1181&amp;nbsp;616&amp;nbsp;411&amp;nbsp;591&amp;nbsp;64&amp;nbsp;240&lt;BR /&gt;2012&amp;nbsp;1125&amp;nbsp;606&amp;nbsp;461&amp;nbsp;555&amp;nbsp;451&amp;nbsp;8&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's put &amp;gt;100 as example, it's char before transpose,&amp;nbsp; after type in sas, &amp;gt;100 becomes number.&amp;nbsp; Regardless, the format does not meet sas requirement anyway.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's say I want to sum along the row, how should I do? thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 18:55:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-work-with-unusual-column-names-after-transpose/m-p/582943#M165889</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-21T18:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to work with unusual column names after transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-work-with-unusual-column-names-after-transpose/m-p/582968#M165901</link>
      <description>&lt;P&gt;thanks you very much, Reeza, it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Total = sum(of '1--25'n --'&amp;gt;100'n);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it's certainly not ideal to use these kinds of headers, but they are informative..It's good to keep them in the headers, thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 19:50:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-work-with-unusual-column-names-after-transpose/m-p/582968#M165901</guid>
      <dc:creator>pensarchem</dc:creator>
      <dc:date>2019-08-21T19:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to work with unusual column names after transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-work-with-unusual-column-names-after-transpose/m-p/582979#M165903</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/273559"&gt;@pensarchem&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;thanks you very much, Reeza, it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Total = sum(of '1--25'n --'&amp;gt;100'n);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it's certainly not ideal to use these kinds of headers, but they are informative..It's good to keep them in the headers, thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then don't use these kinds of headers. Sum the columns instead of summing the rows.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 20:03:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-work-with-unusual-column-names-after-transpose/m-p/582979#M165903</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-08-21T20:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to work with unusual column names after transpose?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-work-with-unusual-column-names-after-transpose/m-p/582983#M165904</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/273559"&gt;@pensarchem&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;thanks you very much, Reeza, it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Total = sum(of '1--25'n --'&amp;gt;100'n);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it's certainly not ideal to use these kinds of headers, but they are informative..It's good to keep them in the headers, thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I disagree and would recommend keeping those as labels, not as variable names. The limits on variable names mean you actually lose information, whereas a label has a lot more flexibility. PROC TRANSPOSE also supports an IDLABEL statement to create nice clean labels. So I would not recommend using those as variable names either.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 20:09:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-work-with-unusual-column-names-after-transpose/m-p/582983#M165904</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-21T20:09:49Z</dc:date>
    </item>
  </channel>
</rss>

