<?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: Making column into row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/739427#M230789</link>
    <description>&lt;P&gt;Thanks a lot KurtBremser. It works fine. If I want to keep one more column in the left for instance in this case GVKEY, what I have to do additionally.&lt;/P&gt;&lt;P&gt;Is it OK if I use the following code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;options missing=0;&lt;/P&gt;&lt;P&gt;proc report data=have;&lt;BR /&gt;column gvkey execid n,year;&lt;BR /&gt;define gvkey / group;&lt;BR /&gt;define execid / group;&lt;BR /&gt;define year / "" across;&lt;BR /&gt;define n / "";&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 06 May 2021 08:28:12 GMT</pubDate>
    <dc:creator>Ramin1</dc:creator>
    <dc:date>2021-05-06T08:28:12Z</dc:date>
    <item>
      <title>Making column into row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/739411#M230781</link>
      <description>&lt;P&gt;Hello Experts,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to make one of the column of my data as the top row or header of the data. I am attaching the file here.&lt;/P&gt;&lt;P&gt;I have&lt;/P&gt;&lt;P&gt;GVKEY SIC DATE EXECID YEAR&lt;/P&gt;&lt;P&gt;123 5555 31/12/2001 246 2001&lt;/P&gt;&lt;P&gt;123 5555 30/6/2003 234 2003&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want&amp;nbsp;&lt;/P&gt;&lt;P&gt;year 2001 2002 2003 ....&lt;/P&gt;&lt;P&gt;execid&amp;nbsp;&lt;/P&gt;&lt;P&gt;246&amp;nbsp; 1 0 0&lt;/P&gt;&lt;P&gt;234&amp;nbsp; 0 0 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to check Execid with year , execid is executives ID. If an executive present in that year then it will be 1 otherwise zero.&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 07:33:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/739411#M230781</guid>
      <dc:creator>Ramin1</dc:creator>
      <dc:date>2021-05-06T07:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: Making column into row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/739419#M230786</link>
      <description>&lt;P&gt;From your csv file, this creates the report:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile '/folders/myfolders/have.csv' firstobs=2 dlm="," truncover;
input
  GVKEY :$6.
  DATE :mmddyy10.
  SIC :$4.
  EXECID :$5.
  year
;
format date yymmdd10.;
run;

options missing=0;

proc report data=have;
column execid n,year;
define execid / group;
define year / "" across;
define n / "";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 May 2021 07:51:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/739419#M230786</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-06T07:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: Making column into row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/739420#M230787</link>
      <description>&lt;P&gt;So, you want a report, right?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;option missing='0';

proc report data=have;
   columns execId year;
   define execID / order;
   define year / across;
run;

options missing='.';&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 May 2021 07:54:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/739420#M230787</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-05-06T07:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: Making column into row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/739427#M230789</link>
      <description>&lt;P&gt;Thanks a lot KurtBremser. It works fine. If I want to keep one more column in the left for instance in this case GVKEY, what I have to do additionally.&lt;/P&gt;&lt;P&gt;Is it OK if I use the following code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;options missing=0;&lt;/P&gt;&lt;P&gt;proc report data=have;&lt;BR /&gt;column gvkey execid n,year;&lt;BR /&gt;define gvkey / group;&lt;BR /&gt;define execid / group;&lt;BR /&gt;define year / "" across;&lt;BR /&gt;define n / "";&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 08:28:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/739427#M230789</guid>
      <dc:creator>Ramin1</dc:creator>
      <dc:date>2021-05-06T08:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Making column into row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/739436#M230792</link>
      <description>&lt;P&gt;You can simplify the code, as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;has shown:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options missing=0;

proc report data=have;
column gvkey execid year;
define gvkey / group;
define execid / group;
define year / "" across;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 May 2021 09:53:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/739436#M230792</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-06T09:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: Making column into row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/742036#M232035</link>
      <description>&lt;P&gt;Hi KurtBremser,&lt;/P&gt;&lt;P&gt;When I use the code, I get the following sas file in the output. But the problem is the file header do not have the year, instead something null. I want the year in the header. I get the ODS excel or text file which provide me year as the header but how can I get SAS file like this?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ruhul_0-1621295614449.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59530i5EE5FC5BA96335FD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ruhul_0-1621295614449.png" alt="Ruhul_0-1621295614449.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 23:55:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/742036#M232035</guid>
      <dc:creator>Ramin1</dc:creator>
      <dc:date>2021-05-17T23:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: Making column into row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/742060#M232043</link>
      <description>&lt;P&gt;Please post your code.&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 05:17:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/742060#M232043</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-18T05:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: Making column into row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/742174#M232080</link>
      <description>&lt;P&gt;Note that wide datasets are mostly useless, especially such like you show. Such layouts are only good as reports meant for human consumption.&lt;/P&gt;
&lt;P&gt;Wide datasets are only needed for regression analysis; are you trying to do such?&lt;/P&gt;
&lt;P&gt;If yes, use PROC TRANSPOSE after introducing a dummy variable:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile '/folders/myfolders/have.csv' firstobs=2 dlm="," truncover;
input
  GVKEY :$6.
  DATE :mmddyy10.
  SIC :$4.
  EXECID :$5.
  year
;
format date yymmdd10.;
value = 1;
run;

proc sort data=have;
by execid year;
run;

proc transpose
  data=have
  out=want (drop=_name_)
  prefix=Y_
;
by execid;
id year;
var value;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want the report as an Excel sheet (which is often the case), just use ODS EXCEL around the PROC REPORT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 14:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/742174#M232080</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-18T14:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: Making column into row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/742521#M232284</link>
      <description>&lt;P&gt;&amp;nbsp;Thanks a lot for your reply. I really appreciate it. Now, I have the following queries&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. What I wanted to say, in the sas output (have file in the picture below), I want same file as in report. In the report I have the years in the header but in sas output file there are _C2_&amp;nbsp; &amp;nbsp;_C3_ ... In excel file it is OK.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ruhul_0-1621398203353.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59573iAB0B3C31DE29EEDC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ruhul_0-1621398203353.png" alt="Ruhul_0-1621398203353.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ruhul_1-1621398273378.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59574iF0B94B7B954384CB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ruhul_1-1621398273378.png" alt="Ruhul_1-1621398273378.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#CODE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;options missing=0;&lt;BR /&gt;ods escapechar = "^";&lt;BR /&gt;ods excel file = "C:\RA\Data Analysis\test1.xlsx";&lt;BR /&gt;ods text = "New Report";&lt;/P&gt;&lt;P&gt;proc report data=tenure out=have;&lt;BR /&gt;column execid n,fyear;&lt;BR /&gt;define execid / group;&lt;BR /&gt;define fyear / "" across;&lt;BR /&gt;define n / "";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;ods excel close;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Now, I want to keep the value of confidence column in the place of 1/0, how can I do that?&lt;BR /&gt;For instance, the output should be something like this&lt;BR /&gt;Execid 2000 2001 2002 ...&lt;/P&gt;&lt;P&gt;09294&amp;nbsp; .0284 .0024&amp;nbsp;&lt;/P&gt;&lt;P&gt;00006&amp;nbsp; 1.8871&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am adding a sas file consisting of confidence column.&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 22:27:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/742521#M232284</guid>
      <dc:creator>Ramin1</dc:creator>
      <dc:date>2021-05-19T22:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: Making column into row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/742634#M232348</link>
      <description>&lt;P&gt;To get a dataset, use PROC TRANSPOSE:&lt;/P&gt;
&lt;P&gt;(I downloaded your dataset to my shared folder)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort
  data=myfold.ten
  out=ten
;
by execid year;
run;

proc transpose
  data=ten
  out=want (drop=_name_)
  prefix=Y_
;
by execid;
id year;
var confidence;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the report, use confidence instead of the N statistic:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=myfold.ten;
column execid confidence,year;
define execid / group;
define year / "" across;
define confidence / "";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 May 2021 11:40:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-column-into-row/m-p/742634#M232348</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-20T11:40:59Z</dc:date>
    </item>
  </channel>
</rss>

