## proc report hide vaue in certain condition case

Solved
Frequent Contributor
Posts: 117

# proc report hide vaue in certain condition case

Hello

In this proc report, I would like to hide the name whenever the sex is F. how could I do that please ?

only hide the name, not remove the line.

thanks for our help in adance

Nasser

``````PROC REPORT NOWD DATA=sashelp.class;
COLUMN  Sex Name Age Height Weight;
DEFINE  Name / DISPLAY ;
DEFINE  Sex / DISPLAY  ;
DEFINE  Age / DISPLAY  ;
DEFINE  Height / display ;
DEFINE  Weight /display  ;
RUN;``````

Accepted Solutions
Solution
‎11-20-2017 12:04 PM
Super User
Posts: 23,667

## Re: proc report hide vaue in certain condition case

Use a COMPUTE block to set it to missing.

``````PROC REPORT NOWD DATA=sashelp.class;
COLUMN  Sex Name Age Height Weight;

compute name;
if sex='F' then name='';
endcomp;

DEFINE  Name / DISPLAY ;
DEFINE  Sex / DISPLAY  ;
DEFINE  Age / DISPLAY  ;
DEFINE  Height / display ;
DEFINE  Weight /display  ;
RUN;``````

All Replies
Solution
‎11-20-2017 12:04 PM
Super User
Posts: 23,667

## Re: proc report hide vaue in certain condition case

Use a COMPUTE block to set it to missing.

``````PROC REPORT NOWD DATA=sashelp.class;
COLUMN  Sex Name Age Height Weight;

compute name;
if sex='F' then name='';
endcomp;

DEFINE  Name / DISPLAY ;
DEFINE  Sex / DISPLAY  ;
DEFINE  Age / DISPLAY  ;
DEFINE  Height / display ;
DEFINE  Weight /display  ;
RUN;``````

Frequent Contributor
Posts: 117

## Re: proc report hide vaue in certain condition case

Thanks Reeza, as you can see on my screenshot in my case, It works for first measure called "ENTREE MENS EN RA" but not for the second "TX SORTIE RA". what I would like is to get measure = ' ' (or test) whenever the genration is not ' '. Thanks a lot

``````	PROC REPORT DATA = work.T20_MEASURE_M0
(where=(measure like ('%LRA%sans cumul M0'))) missing nowd ;
column axe_produit generation measure  periode_month_M0 , flag_real_prev , value ;
define axe_produit / group '' style(column)={FONT_SIZE=11pt background=blue color=white} ;
define generation / group '' order =  DATA style(column)={CELLWIDTH = 1in FONT_SIZE=11pt} ;
define measure / group '' style(column)={CELLWIDTH = 2in FONT_SIZE=11pt} style(header)={CELLWIDTH = 2in} format= \$f_measure_label. ;
compute measure ;
If generation ne '' then measure = 'test' ;
endcomp ;
define periode_month_M0 / across '' order =  DATA style(column)={CELLWIDTH = 2in} style (header)={FONT_SIZE=11pt} ;
define flag_real_prev / '' across format = \$ReelPrev. order =  DATA style(column)={CELLWIDTH = 2in} style(header)={CELLWIDTH = 2in FONT_SIZE=11pt background=blue color=white} ;
define value / '' style(column)={FONT_SIZE=11pt} ;
compute value ;
if INDEX(measure,'Mont') then do ;
call define(_COL_,'FORMAT','12.0') ;
call define(_COL_,'STYLE','style={TAGATTR="# ###,###"}') ;
end;
else call define(_COL_,'FORMAT','percentn12.2') ;
endcomp ;
RUN ;``````

Super User
Posts: 23,667

## Re: proc report hide vaue in certain condition case

In PROC REPORT, order of statements matter. Try moving the COMPUTE before the DEFINE statement, similar to the posted example.

Posts: 2,983

## Re: proc report hide vaue in certain condition case

Create a temporary dataset from SASHELP.CLASS where the name is set to missing if the sex is female. Then run PROC REPORT.

--
Paige Miller
☑ This topic is solved.