<?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: hide or delete a column according to my group by in proc report ods excel in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/hide-or-delete-a-column-according-to-my-group-by-in-proc-report/m-p/900118#M355746</link>
    <description>&lt;P&gt;Try this one :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=class ;by sex; run;
data report_data;
set class;
by sex;
if sex ='F' then do;column_display='limited';weight=.;end;  /*&amp;lt;-----*/
if sex='M' then  column_display='all';
run;
ods excel file='C:\temp\class.xlsx'
options(
embedded_footnotes='yes' sheet_name = "#byval1"  contents="yes");
PROC REPORT data=report_data; 
by sex;
column   age sex name height weight;
define age/group;
define sex /display;
define name /display;
define height/mean;
define weight/sum nozero ;  /*&amp;lt;-----*/

compute weight;
if column_display='limited' then  call define(_col_,'style',"style={visibility=hidden}");
endcomp;
run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 26 Oct 2023 11:47:26 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2023-10-26T11:47:26Z</dc:date>
    <item>
      <title>hide or delete a column according to my group by in proc report ods excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/hide-or-delete-a-column-according-to-my-group-by-in-proc-report/m-p/900113#M355744</link>
      <description>&lt;P&gt;Good morning,&lt;BR /&gt;I have a proc report, with a display of tabs according to my "group by" in ods excel.&lt;BR /&gt;I take the example of the class table.&lt;BR /&gt;If I have 2 sheet according to my "group by" "Sex" (F and M) I want to display all of my columns if I am in the (M) sheet.&lt;BR /&gt;and if I am in sheet (F) I want to hide a few columns (example hide weight).&lt;BR /&gt;I built this code but it doesn't work!!!&lt;BR /&gt;could you help me ?&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;I specify that I used the class table only to present my problem.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;my real data contains around fifty columns&amp;nbsp; and several sheet&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="snip_1-1698316762668.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/89105i4CF3CB1480998F4E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="snip_1-1698316762668.png" alt="snip_1-1698316762668.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="snip_2-1698316794441.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/89106iF28101090AED1A35/image-size/medium?v=v2&amp;amp;px=400" role="button" title="snip_2-1698316794441.png" alt="snip_2-1698316794441.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=class ;by sex; run;
data report_data;
set class;
by sex;
if sex ='F' then column_display='limited';
if sex='M' then  column_display='all';
run;
ods excel file='C:\temp\class.xlsx'
options(
embedded_footnotes='yes' sheet_name = "#byval1"  contents="yes");
PROC REPORT data=report_data; 
by sex;
column   age sex name height weight;
define age/group;
define sex /display;
define name /display;
define height/mean;
define weight/sum;

compute weight;
if column_display='limited' then  call define(_col_,'style',"style={visibility=hidden}");
endcomp;
run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Oct 2023 10:47:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/hide-or-delete-a-column-according-to-my-group-by-in-proc-report/m-p/900113#M355744</guid>
      <dc:creator>snip</dc:creator>
      <dc:date>2023-10-26T10:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: hide or delete a column according to my group by in proc report ods excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/hide-or-delete-a-column-according-to-my-group-by-in-proc-report/m-p/900118#M355746</link>
      <description>&lt;P&gt;Try this one :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=class ;by sex; run;
data report_data;
set class;
by sex;
if sex ='F' then do;column_display='limited';weight=.;end;  /*&amp;lt;-----*/
if sex='M' then  column_display='all';
run;
ods excel file='C:\temp\class.xlsx'
options(
embedded_footnotes='yes' sheet_name = "#byval1"  contents="yes");
PROC REPORT data=report_data; 
by sex;
column   age sex name height weight;
define age/group;
define sex /display;
define name /display;
define height/mean;
define weight/sum nozero ;  /*&amp;lt;-----*/

compute weight;
if column_display='limited' then  call define(_col_,'style',"style={visibility=hidden}");
endcomp;
run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Oct 2023 11:47:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/hide-or-delete-a-column-according-to-my-group-by-in-proc-report/m-p/900118#M355746</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-10-26T11:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: hide or delete a column according to my group by in proc report ods excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/hide-or-delete-a-column-according-to-my-group-by-in-proc-report/m-p/900167#M355767</link>
      <description>A side note-- in order to test the COLUMN_DISPLAY variable in the COMPUTE block for WEIGHT, the best practice is for the COLUMN_DISPLAY variable  to be listed on the COLUMN statement in PROC REPORT. Otherwise, you'll get a message like this in the LOG:&lt;BR /&gt;NOTE: Variable column_display is uninitialized.&lt;BR /&gt;  When worked at a place where I had to turn in my LOG with my REPORTS, notes like this were not allowed because the LOGS were shown to our clients and they would not sign off on a report with a note like this.&lt;BR /&gt;Cynthia</description>
      <pubDate>Thu, 26 Oct 2023 16:22:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/hide-or-delete-a-column-according-to-my-group-by-in-proc-report/m-p/900167#M355767</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2023-10-26T16:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: hide or delete a column according to my group by in proc report ods excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/hide-or-delete-a-column-according-to-my-group-by-in-proc-report/m-p/900181#M355776</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;Thank you Ksharp for your reply.&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt;&amp;nbsp;Thank you Cyntia for the clarification.&lt;BR /&gt;I forgot to mention that among my data there are also calculated columns.&lt;BR /&gt;This solution works with display and analysis columns but I have difficulty making it work on a calculated column.&lt;BR /&gt;Is there a trick to make this work?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 17:31:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/hide-or-delete-a-column-according-to-my-group-by-in-proc-report/m-p/900181#M355776</guid>
      <dc:creator>snip</dc:creator>
      <dc:date>2023-10-26T17:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: hide or delete a column according to my group by in proc report ods excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/hide-or-delete-a-column-according-to-my-group-by-in-proc-report/m-p/900300#M355813</link>
      <description>&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;Hello,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;is there anyone who can help me?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;I'm really stuck and I haven't been able to find the solution for almost 2 days&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":sad_but_relieved_face:"&gt;😥&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":sad_but_relieved_face:"&gt;😥&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 10:19:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/hide-or-delete-a-column-according-to-my-group-by-in-proc-report/m-p/900300#M355813</guid>
      <dc:creator>snip</dc:creator>
      <dc:date>2023-10-27T10:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: hide or delete a column according to my group by in proc report ods excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/hide-or-delete-a-column-according-to-my-group-by-in-proc-report/m-p/900309#M355818</link>
      <description>Cynthia,&lt;BR /&gt;That PROC REPORT was not writed by me,&lt;BR /&gt;I just COPY it form OP and add some sauce to make it work.</description>
      <pubDate>Fri, 27 Oct 2023 11:31:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/hide-or-delete-a-column-according-to-my-group-by-in-proc-report/m-p/900309#M355818</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-10-27T11:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: hide or delete a column according to my group by in proc report ods excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/hide-or-delete-a-column-according-to-my-group-by-in-proc-report/m-p/900310#M355819</link>
      <description>Since your requirement is too much, I suggested you to make a MACRO to output a sheet one by one .Like:&lt;BR /&gt;&lt;BR /&gt;ods excel options(sheet_name = "F"  );&lt;BR /&gt;PROC REPORT data=report_data nowd; &lt;BR /&gt;where sex='F';&lt;BR /&gt;.......................&lt;BR /&gt;&lt;BR /&gt;ods excel options(sheet_name = "M"  );&lt;BR /&gt;PROC REPORT data=report_data nowd; &lt;BR /&gt;where sex='M';&lt;BR /&gt;.......................</description>
      <pubDate>Fri, 27 Oct 2023 11:33:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/hide-or-delete-a-column-according-to-my-group-by-in-proc-report/m-p/900310#M355819</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-10-27T11:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: hide or delete a column according to my group by in proc report ods excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/hide-or-delete-a-column-according-to-my-group-by-in-proc-report/m-p/900321#M355821</link>
      <description>&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 12:26:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/hide-or-delete-a-column-according-to-my-group-by-in-proc-report/m-p/900321#M355821</guid>
      <dc:creator>snip</dc:creator>
      <dc:date>2023-10-27T12:26:08Z</dc:date>
    </item>
  </channel>
</rss>

