BookmarkSubscribeRSS Feed
Cynthia_sas
SAS Super FREQ

Hi, well, with nestings like that, PROC REPORT thinks you have the possibility of 48 total ACROSS columns 3 variables (total, defects,percent) times 4 possible values for DOW times 4 possible values for DATE -- so 3*4*4 = 48. You can prove this to yourself by getting rid of the NOZERO and something like this is what you see:

behind_the_scenes.png

 

So unfortunately when you nest multiple variables in the ACROSS you are telling PROC REPORT to make absolute column numbers for all the POSSIBLE combinations - not all the ACTUAL combinations.

 

If this is what you want:

using_a_format.png

I did that with a user-defined format:

 


** need to use ^ as the split character in PROC REPORT step;
  
proc format;
  value dtdow '14sep17'd = '09/14/2017^Thu'
              '15sep17'd = '09/15/2017^Fri'
              '16sep17'd = '09/16/2017^Sat'
              '17sep17'd = '09/17/2017^Sun';
run;

Proc report data=TEST  split = '^'
	style(summary)=Header
	style(column)=[font_size=8pt] nowindows;
column WIDGET 
		DATE, (TOTAL DEFECTS PERCENT);

define WIDGET / group   '  Widgets  ' style(column)={just=left  };
define DATE   / across   '  Date  ' FORMAT=dtdow.
				style(column)={just=center  } 		;
 define TOTAL  /  sum  'TOTAL' F=COMMA7. 
               STYLE(column)={just=center };
define DEFECTS /  sum  'DEFECTS' F=COMMA7. 
                STYLE(column)={just=center };
define PERCENT/ computed 'PERCENT' f=PERCENT9.2 
                style(column)={just=center }  ;

compute PERCENT;
_c4_ = _c2_ / _c3_ ;
_c7_ = _c5_ / _c6_ ;
_c10_ = _c8_ / _c9_ ;
_c13_ = _c11_ / _c12_ ;
endcomp;

rbreak after / summarize;
Run;

I did not bother using all of your cellwidths because I don't use cellwidths without a unit of measure and I did not use TAGSETS.EXCELXP because the column headers and nestings for ACROSS will be the same no matter what destination you use.

 

Hope this helps.

 

cynthia

 

ps -- in the future, it's better to post a new topic and then refer to an older posting if it is relevant. That way, people don't have to read all the way through the previous posting to get to your question and answer.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 15 replies
  • 11138 views
  • 3 likes
  • 4 in conversation