BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi everyone,
I was wondering if anyone could help me with a question I have with proc report. I used the following codes to create a table ordered by the variable "count". I used ods msoffice2k option to save my table in excel. The problem I had was cell values for "count" became missing when the adjacent cells were associated with the same value. Does anybody know of a way to force the values of the order variable to be presented in the table? Thanks very much in advance.

ods msoffice2k file="freq_sex.xls " path=odsout style=minimal ;

proc report data=report nowd headline headskip ;

columns sex_1 count pct_total;

define sex_1 / display "Field Name" left ;
define count / order descending "Record Count" center ;
define pct_total / display "Percent Total";

run ;

Sample output:

Field Name Record Count Percent Total
Female 121 50%
Male 50%
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
These couple of examples may help...not with a count variable, just with sashelp.class and how to show a value for an order or group variable (use a computed column).
cynthia
[pre]
ods msoffice2k file="c:\temp\prtgend.xls "
style=minimal ;

proc report data=sashelp.class nowd ;
title 'proc report examp -- use NOPRINT on SEX var after seeing how PRTGEND works';
columns sex prtgend name age;
define sex / order "Gender1 as Order";
define prtgend / computed 'Gender2';
define age / display "age";
compute before sex;
length holdvar $1;
holdvar = sex;
endcomp;
compute prtgend / character length=1;
prtgend = holdvar;
endcomp;
run ;

proc report data=sashelp.class nowd;
title 'Summary Report with Proc Report';
columns sex n pctn;
define sex / group 'Gender';
define n / 'Count';
define pctn / 'Percent' f=percent8.2;
rbreak after / summarize;
run;
ods msoffice2k close;
[/pre]
deleted_user
Not applicable
Thank you Cynthia! It worked.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 651 views
  • 0 likes
  • 2 in conversation