<?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: Transform the data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Transform-the-data/m-p/341048#M77989</link>
    <description>&lt;P&gt;You can use next code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=temp
     out=want(drop=_name_) prefix=Y ;
by company;
id time;
var earning; 
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 15 Mar 2017 03:03:49 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2017-03-15T03:03:49Z</dc:date>
    <item>
      <title>Transform the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-the-data/m-p/341032#M77983</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I have data like this :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
input company$ time earning;
cards;
A 1993 45
A 1994 52
B 1993 42
B 1994 59
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and i would like to transform the data like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;1993 1994&lt;/P&gt;&lt;P&gt;A &amp;nbsp;45 &amp;nbsp; &amp;nbsp;52&lt;/P&gt;&lt;P&gt;B &amp;nbsp;42 &amp;nbsp; &amp;nbsp;59&lt;/P&gt;&lt;P&gt;How can I do it ? Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2017 02:01:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-the-data/m-p/341032#M77983</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-03-15T02:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Transform the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-the-data/m-p/341048#M77989</link>
      <description>&lt;P&gt;You can use next code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=temp
     out=want(drop=_name_) prefix=Y ;
by company;
id time;
var earning; 
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Mar 2017 03:03:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-the-data/m-p/341048#M77989</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-03-15T03:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: Transform the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-the-data/m-p/341049#M77990</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
input company$ time earning;
cards;
A 1993 45
A 1994 52
B 1993 42
B 1994 59
;
run;

proc sort data=temp;
by company time earning;
run;

proc transpose data=temp out=want;
by company;
id time;
var earning;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Mar 2017 03:05:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-the-data/m-p/341049#M77990</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-03-15T03:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Transform the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-the-data/m-p/341063#M77995</link>
      <description>&lt;P&gt;Not recommended to have variable names that only include numbers, since not all SAS procedures honor the validvarname=any option. However, that said, the following will do what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Interestingly, in running the following SAS will produce warnings in the log that &amp;nbsp;_1993 and _1994 don't exist, but it does recode the variable names correctly:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data temp;
input company$ time earning;
cards;
A 1993 45
A 1994 52
B 1993 42
B 1994 59
;
run;

proc sort data=temp;
by company time earning;
run;

options validvarname=any;

proc transpose data=temp 
     out=want(drop=_name_ rename=(_1993='1993'n _1994='1994'n));
  by company;
  id time;
  var earning;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2017 04:13:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-the-data/m-p/341063#M77995</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-15T04:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: Transform the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-the-data/m-p/341109#M78019</link>
      <description>&lt;P&gt;Thank you for your patience with so simple problem.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2017 08:31:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-the-data/m-p/341109#M78019</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-03-15T08:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: Transform the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-the-data/m-p/341207#M78067</link>
      <description>&lt;P&gt;I stand/sit corrected regarding my previous response. When validvarname=any is in effect, proc transpose doesn't preface the new variables with underscores .. which is why the warning occurred when I included the rename option. Only the following was needed:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;options validvarname=any;

proc transpose data=temp 
     out=want(drop=_name_);
  by company;
  id time;
  var earning;
run;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2017 14:42:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-the-data/m-p/341207#M78067</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-15T14:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Transform the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-the-data/m-p/341315#M78096</link>
      <description>&lt;P&gt;ok, thank u very much!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2017 19:29:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-the-data/m-p/341315#M78096</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-03-15T19:29:39Z</dc:date>
    </item>
  </channel>
</rss>

