<?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: Managing data in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Managing-data/m-p/286636#M8159</link>
    <description>&lt;P&gt;Below code brings your source data into a shape which is favourable for quite a few PROC's - eg. Proc Report for what I believe you're trying to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.phil(keep=companyname credeb year amount);
  infile 'c:\test\phil.csv' firstobs=2 lrecl=255 dlm=',' truncover dsd;
  input CompanyName :$50. Var :$30. (YearIn2000 - YearIn2015) (:$20.);

  if compress(upcase(var)) in ('TOTALASSETS','TOTALDEBT');

  if compress(upcase(var))='TOTALASSETS' then CreDeb='C';
  else CreDeb='D';

  array years {*} YearIn:;
  do _i=1 to dim(years);
    Year=input(compress(vname(years(_i)),,'kd'),best32.);
    Amount=input(years(_i),?? best32.);;
    output;
  end;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 24 Jul 2016 04:35:32 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2016-07-24T04:35:32Z</dc:date>
    <item>
      <title>Managing data</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Managing-data/m-p/286628#M8156</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have data in this form&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;companyname variable Year1 Year2 year3 Year4 Year5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Abc &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;assets&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Abc &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;liabilities&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-----&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I want the data in the form&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Companyname Year &amp;nbsp; &amp;nbsp; Assets &amp;nbsp;Liabilities &amp;nbsp;Deficit&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Abc &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; year1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Abc &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Year2&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone here guide me how can i convert data in first format to second?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I am attaching the excel file here. Sheet1 of excel file is the original data. i want my data in the format of sheet2.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2016 03:07:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Managing-data/m-p/286628#M8156</guid>
      <dc:creator>Jahanzaib</dc:creator>
      <dc:date>2016-07-24T03:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Managing data</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Managing-data/m-p/286632#M8157</link>
      <description>&lt;P&gt;Look at proc transpose.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS I don't download XLSX files and many others don't as well. It's best to be as detailed as possible in your question.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2016 03:30:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Managing-data/m-p/286632#M8157</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-24T03:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: Managing data</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Managing-data/m-p/286634#M8158</link>
      <description>&lt;P&gt;i have added the file both in CSV and excel format in the attached zip folder.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2016 03:45:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Managing-data/m-p/286634#M8158</guid>
      <dc:creator>Jahanzaib</dc:creator>
      <dc:date>2016-07-24T03:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: Managing data</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Managing-data/m-p/286636#M8159</link>
      <description>&lt;P&gt;Below code brings your source data into a shape which is favourable for quite a few PROC's - eg. Proc Report for what I believe you're trying to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.phil(keep=companyname credeb year amount);
  infile 'c:\test\phil.csv' firstobs=2 lrecl=255 dlm=',' truncover dsd;
  input CompanyName :$50. Var :$30. (YearIn2000 - YearIn2015) (:$20.);

  if compress(upcase(var)) in ('TOTALASSETS','TOTALDEBT');

  if compress(upcase(var))='TOTALASSETS' then CreDeb='C';
  else CreDeb='D';

  array years {*} YearIn:;
  do _i=1 to dim(years);
    Year=input(compress(vname(years(_i)),,'kd'),best32.);
    Amount=input(years(_i),?? best32.);;
    output;
  end;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 24 Jul 2016 04:35:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Managing-data/m-p/286636#M8159</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2016-07-24T04:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: Managing data</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Managing-data/m-p/286661#M8160</link>
      <description>&lt;P&gt;Thanks Patrick for your kindly reply.&lt;/P&gt;
&lt;P&gt;Sorry for disturbing you again. I&amp;nbsp;have sent you the wrong file.&lt;/P&gt;
&lt;P&gt;I am again attaching the file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sheet1 in this data set is data available with me.&lt;/P&gt;
&lt;P&gt;Sheet2 is the form of data set that i want.&lt;/P&gt;
&lt;P&gt;Thanks in anticipation&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2016 14:36:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Managing-data/m-p/286661#M8160</guid>
      <dc:creator>Jahanzaib</dc:creator>
      <dc:date>2016-07-24T14:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: Managing data</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Managing-data/m-p/286786#M8161</link>
      <description>&lt;P&gt;The basic method for using proc transpose for such a problem looks like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input company$ variable$ val2000 val2001 val2002;
cards;
a x 1 2 3
a y 4 5 6
a z 7 8 9
b x 11 12 13
b y 14 15 16
b z 17 18 19
;
run;

proc transpose data=have out=want (rename=(_name_=year));
by company;
id variable;
var _numeric_;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Make sure that your "have" dataset has values in "variable" that comply to SAS naming conventions, otherwise you will have a hard time dealing with the variable names.&lt;/P&gt;
&lt;P&gt;In my given example, you might want to run a second data step that converts the "year" variable to numeric.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2016 07:10:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Managing-data/m-p/286786#M8161</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-07-25T07:10:40Z</dc:date>
    </item>
  </channel>
</rss>

