BookmarkSubscribeRSS Feed
Pinky9
Calcite | Level 5

Hi ,

I have used the below syntax to generate the table.

ODS html body='D:\SAS Project\Output\sample3.xls';

proc tabulate data=prac.parents;

format gender gender. c2_2 prefer.;

class age gender c2_2/mlf preloadfmt order=data ;

tables all='Base :All Respondents'*f=9.0*N='' c2_2=''*colpctn='' ,(all='Total' gender)*f=7.2;

run;

ODS html close;

Output :

TotalGender
MaleFemale
Base :All Respondents 365227138
Bottom2 Box[1/2] 0.55.1.45
[2] Somewhat unfavorable 0.55.1.45
[3] Neutral 24.6619.8232.61
[4] Somewhat favorable 46.8548.943.48
Top2 Box[4/5] 74.7980.1865.94
[5] Very favorable 27.9531.2822.46

Query : please explain syntax to delete the empty column before "Total" column.

Thanks

4 REPLIES 4
LinusH
Tourmaline | Level 20

What empty column? It's not clear in the output what you mean.

Please search http://support.sas.com and this community for a solution before posting any new question in community.

Data never sleeps
Pinky9
Calcite | Level 5

Hi LinusH,

Please run the above code at your end with your dataset, to know the problem. If you look at the output , u will realize there is a empty col before "Total col" which is not reflected when pasted.

thanks

Astounding
PROC Star

It looks like your extra column is the unlabeled N and COLPCTN statistic.  The only way I see around this is to transpose the table.  Make the columns contain Total, Male, and Female, for example.  When blank statistic labels appear in the column dimension of the table, the label gets entirely removed.

Somebody else may come up with another way around this, or perhaps the transposed version is acceptable.

Good luck.

Pinky9
Calcite | Level 5

thanks

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 4 replies
  • 764 views
  • 1 like
  • 3 in conversation