<?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: proc transpose numeric suffix issue? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-numeric-suffix-issue/m-p/369487#M65045</link>
    <description>&lt;P&gt;If the variables in the dataset are structured such that each set of names are in order (left to right), you can use '--' for each set of variables. This will take all variables in the dataset between and including the ones listed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I.e.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=have out=trans
var Sale1_record--Sale6_record;
by CarID;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 22 Jun 2017 14:06:31 GMT</pubDate>
    <dc:creator>Rwon</dc:creator>
    <dc:date>2017-06-22T14:06:31Z</dc:date>
    <item>
      <title>proc transpose numeric suffix issue?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-numeric-suffix-issue/m-p/369159#M65022</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have transpose program below.&amp;nbsp; However, I got an error message for Log shown below.&amp;nbsp; Please advice how to fix this question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;transpose&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=have &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=trans&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;prefix&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=Sale_record;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;var&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Sale1_recode-Sale6_record;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; CarID; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR:&amp;nbsp;Sale1_record does not have a numeric suffix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 14:13:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-numeric-suffix-issue/m-p/369159#M65022</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-06-21T14:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: proc transpose numeric suffix issue?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-numeric-suffix-issue/m-p/369162#M65023</link>
      <description>&lt;P&gt;The "-" to list variables only applies when the variables have a numeric suffix: sales1- sales10.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use a "--" to list variables that are actually in that order in the data, but be sure of what you're asking it to do.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 14:16:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-numeric-suffix-issue/m-p/369162#M65023</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-06-21T14:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: proc transpose numeric suffix issue?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-numeric-suffix-issue/m-p/369189#M65024</link>
      <description>&lt;P&gt;To add on to Collin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You will have to list out all the variables in the var statement since they don't end in a number.&amp;nbsp;Alternatively, you can&amp;nbsp;rename the variables to end with a number if you want to use the '-' feature.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming that 'Sale1_recode' was a typo for 'Sale1_record':&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;*Method 1;
proc transpose data=have out=trans
var Sale1_record Sale2_record Sale3_record Sale4_record Sale5_record Sale6_record;
by CarID;
run;
quit;

*Method 2;
proc transpose data=have(rename=(Sale1_record=Sale_record1 Sale2_record=Sale_record2 Sale3_record=Sale_record3 
                                 Sale4_record=Sale_record4 Sale5_record=Sale_record5 Sale6_record=Sale_record6)) 
                         out=trans
prefix=Sale_record;
var Sale_record1-Sale_record6;
by CarID;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 15:17:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-numeric-suffix-issue/m-p/369189#M65024</guid>
      <dc:creator>Rwon</dc:creator>
      <dc:date>2017-06-21T15:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: proc transpose numeric suffix issue?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-numeric-suffix-issue/m-p/369439#M65043</link>
      <description>&lt;P&gt;Hi, Rwon:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your information.&amp;nbsp; unfortunately, I have 50 similar names as Sale(n)_record.&amp;nbsp;&amp;nbsp; I can't list all of them one by one.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2017 11:47:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-numeric-suffix-issue/m-p/369439#M65043</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-06-22T11:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: proc transpose numeric suffix issue?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-numeric-suffix-issue/m-p/369487#M65045</link>
      <description>&lt;P&gt;If the variables in the dataset are structured such that each set of names are in order (left to right), you can use '--' for each set of variables. This will take all variables in the dataset between and including the ones listed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I.e.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=have out=trans
var Sale1_record--Sale6_record;
by CarID;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Jun 2017 14:06:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-numeric-suffix-issue/m-p/369487#M65045</guid>
      <dc:creator>Rwon</dc:creator>
      <dc:date>2017-06-22T14:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: proc transpose numeric suffix issue?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-numeric-suffix-issue/m-p/369500#M65046</link>
      <description>&lt;P&gt;In the future make sure to name series of variablees with the sequence number at the end of the name.&lt;/P&gt;
&lt;P&gt;Personally for a one off analysis I would just run a little program to generate the names and then copy and paste them.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  do i=1 to 50 ;
    name = cats('sales',i,'_record');
    put name ;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you find that you need to reference a number of different lists of variables in this way then you might want to make a little macro to generate the names.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro names(n,prefix,suffix);
%local i;
%do i=1 %to &amp;amp;n ; &amp;amp;prefix.&amp;amp;i.&amp;amp;suffix %end;
%mend;
...
var %names(50,sales,_record);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Jun 2017 14:17:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-numeric-suffix-issue/m-p/369500#M65046</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-06-22T14:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: proc transpose numeric suffix issue?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-numeric-suffix-issue/m-p/369502#M65047</link>
      <description>&lt;P&gt;Could I use dim to replace 50?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2017 14:18:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-numeric-suffix-issue/m-p/369502#M65047</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-06-22T14:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: proc transpose numeric suffix issue?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-numeric-suffix-issue/m-p/369521#M65048</link>
      <description>&lt;P&gt;DIM() of what?&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Could I use dim to replace 50?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2017 14:40:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-transpose-numeric-suffix-issue/m-p/369521#M65048</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-06-22T14:40:14Z</dc:date>
    </item>
  </channel>
</rss>

