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;
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;
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;
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 ;
In PROC REPORT, order of statements matter. Try moving the COMPUTE before the DEFINE statement, similar to the posted example.
Create a temporary dataset from SASHELP.CLASS where the name is set to missing if the sex is female. Then run PROC REPORT.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.