BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Nasser_DRMCP
Lapis Lazuli | Level 10

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;
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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;

 

View solution in original post

4 REPLIES 4
Reeza
Super User

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;

 

Nasser_DRMCP
Lapis Lazuli | Level 10

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 ;

 

 

 

Capture.PNG

Reeza
Super User

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

PaigeMiller
Diamond | Level 26

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 802 views
  • 3 likes
  • 3 in conversation