Desktop productivity for business analysts and programmers

Help to left-align row values in Proc Freq crosstab

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 5
Accepted Solution

Help to left-align row values in Proc Freq crosstab

Hi

When I make crosstabs by using Proc Freq, I get the following output:

Unavngivet.png

How can I left-align the row values? (ie. Z038/39 and Z048)

I'm using SAS EG 5.1 32 bit.

Hope someone can help.

Thank you.


Accepted Solutions
Solution
‎05-29-2015 08:54 AM
Grand Advisor
Posts: 9,576

Re: Help to left-align row values in Proc Freq crosstab

How about this one :

data class;
 set sashelp.class;
 length _sex $ 40;
 _sex=catx(' ','~S={just=l}',sex);
run;



ods listing close;
ods pdf file='c:\temp\x.pdf';
ods escapechar='~';
proc freq data=class ;
table _sex*age/norow nocol nopercent nocum ;
run;
ods pdf close;
ods listing;

x.png

Xia Keshan

View solution in original post


All Replies
Solution
‎05-29-2015 08:54 AM
Grand Advisor
Posts: 9,576

Re: Help to left-align row values in Proc Freq crosstab

How about this one :

data class;
 set sashelp.class;
 length _sex $ 40;
 _sex=catx(' ','~S={just=l}',sex);
run;



ods listing close;
ods pdf file='c:\temp\x.pdf';
ods escapechar='~';
proc freq data=class ;
table _sex*age/norow nocol nopercent nocum ;
run;
ods pdf close;
ods listing;

x.png

Xia Keshan

Occasional Contributor
Posts: 5

Re: Help to left-align row values in Proc Freq crosstab

Thank you for your answer.

It Works perfectly.

Great way to use the ODS Escape Char Smiley Happy

Grand Advisor
Posts: 10,210

Re: Help to left-align row values in Proc Freq crosstab

Or slight modification:

proc format library=work;
value $sextemp
'F' = '~S={just=L}F'
'M' = '~S={just=L}M'
;
run;
quit;

ods escapechar='~';
proc freq data=class ;
table sex*age/norow nocol nopercent nocum ;
format sex $sextemp.;
run;

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 534 views
  • 3 likes
  • 3 in conversation