<?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 proc report across a variable but output another variable's value in the cell in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/proc-report-across-a-variable-but-output-another-variable-s/m-p/630198#M30233</link>
    <description>&lt;P&gt;Hi, I have some data that looks something like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have1;&lt;BR /&gt;input ID question$ subcat$ response$;&lt;BR /&gt;datalines;&lt;BR /&gt;1 Q1 a Y&lt;BR /&gt;1 Q1 b Y&lt;BR /&gt;1 Q1 c Y&lt;BR /&gt;1 Q2 a Y&lt;BR /&gt;1 Q2 b Y&lt;BR /&gt;1 Q2 c N&lt;BR /&gt;1 Q2 d N&lt;BR /&gt;1 Q2 e Y&lt;BR /&gt;2 Q1 a N&lt;BR /&gt;2 Q1 b Y&lt;BR /&gt;2 Q1 c Y&lt;BR /&gt;2 Q2 a N&lt;BR /&gt;2 Q2 b Y&lt;BR /&gt;2 Q2 c N&lt;BR /&gt;2 Q2 d N&lt;BR /&gt;2 Q2 e Y&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need the data to look like this:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Q1&lt;/TD&gt;&lt;TD&gt;Q2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;c&lt;/TD&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;c&lt;/TD&gt;&lt;TD&gt;d&lt;/TD&gt;&lt;TD&gt;e&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Y&lt;/TD&gt;&lt;TD&gt;Y&lt;/TD&gt;&lt;TD&gt;Y&lt;/TD&gt;&lt;TD&gt;Y&lt;/TD&gt;&lt;TD&gt;Y&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;Y&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;Y&lt;/TD&gt;&lt;TD&gt;Y&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;Y&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;Y&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do we make the response variable output to the cell?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Mar 2020 19:08:20 GMT</pubDate>
    <dc:creator>gsk</dc:creator>
    <dc:date>2020-03-06T19:08:20Z</dc:date>
    <item>
      <title>proc report across a variable but output another variable's value in the cell</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-report-across-a-variable-but-output-another-variable-s/m-p/630198#M30233</link>
      <description>&lt;P&gt;Hi, I have some data that looks something like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have1;&lt;BR /&gt;input ID question$ subcat$ response$;&lt;BR /&gt;datalines;&lt;BR /&gt;1 Q1 a Y&lt;BR /&gt;1 Q1 b Y&lt;BR /&gt;1 Q1 c Y&lt;BR /&gt;1 Q2 a Y&lt;BR /&gt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;&lt;TD&gt;Y&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;Y&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do we make the response variable output to the cell?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 19:08:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-report-across-a-variable-but-output-another-variable-s/m-p/630198#M30233</guid>
      <dc:creator>gsk</dc:creator>
      <dc:date>2020-03-06T19:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: proc report across a variable but output another variable's value in the cell</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-report-across-a-variable-but-output-another-variable-s/m-p/630200#M30234</link>
      <description>&lt;P&gt;I don't think you can have character values Y and N underneath across variables, unless you make them numeric and formatted to produce Y and N.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
input ID question$ subcat$ response$;
if response='Y' then numeric_Response=1;
else numeric_response=0;
datalines;
1 Q1 a Y
1 Q1 b Y
1 Q1 c Y
1 Q2 a Y
1 Q2 b Y
1 Q2 c N
1 Q2 d N
1 Q2 e Y
2 Q1 a N
2 Q1 b Y
2 Q1 c Y
2 Q2 a N
2 Q2 b Y
2 Q2 c N
2 Q2 d N
2 Q2 e Y
;

proc format;
    value nf 1='Y' 0='N';
run;

proc report data=have1 nocompletecols;
    columns ("ID" id) question,subcat,numeric_response;
    define id/group ' ';
    define question/across;
    define subcat/across;
    define numeric_response/sum ' ' format=nf.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 19:23:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-report-across-a-variable-but-output-another-variable-s/m-p/630200#M30234</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-06T19:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: proc report across a variable but output another variable's value in the cell</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-report-across-a-variable-but-output-another-variable-s/m-p/630325#M30235</link>
      <description>&lt;P&gt;How about this one ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
input ID question $ subcat $ response $;
datalines;
1 Q1 a Y
1 Q1 b Y
1 Q1 c Y
1 Q2 a Y
1 Q2 b Y
1 Q2 c N
1 Q2 d N
1 Q2 e Y
2 Q1 a N
2 Q1 b Y
2 Q1 c Y
2 Q2 a N
2 Q2 b Y
2 Q2 c N
2 Q2 d N
2 Q2 e Y
;
proc report data=have1 nowd ;
    columns ('ID' id) question,subcat,response;
    define id/group ' ';
    define question/across ' ' nozero;
    define subcat/across ' ' nozero;
    define response/group ' ' nozero ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 07 Mar 2020 06:48:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-report-across-a-variable-but-output-another-variable-s/m-p/630325#M30235</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-03-07T06:48:39Z</dc:date>
    </item>
  </channel>
</rss>

