BookmarkSubscribeRSS Feed
Defense
Obsidian | Level 7

I have a sas datsset create as below:

 

proc format;

value gender

1=male

2=femal;

run;

 

DATA have;

input group id sex ;

format sex gender.;

datalines;

1 133 1

3 134 1

;

run;

 

( sas dataset Have)

 

obs group   id    sex

 1   1      133   male

 2   3      134   male

 

Then I run proc report code as below:

 

proc report data=have; run;

 

The output upexpect as below(colum total):

group id   sex

4     267  femal

 

How can I fix this problem? it sounds because format

 

Thank

 

 

 

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

Hi:
You do not have any define statements in your PROC REPORT code. GROUP and ID variables are numeric and by default, numeric variables have a usage of SUM. So you have values of 1 and 3 in for your two rows, and 1+3 = 4. You have values of 133 and 134 for ID and 133+134 = 267.

My suggestion is that you review the DEFINE statement. And, as an example of what you need to do, consider this code and output.

cynthia

 

report_usage_important.png

Defense
Obsidian | Level 7

Thanks

 

In my real datsset, there is one more character variable. I will try to use define/order optiom to see if it workd.

Ksharp
Super User


proc format;
value gender
1='male'
2='femal';
run;

 

DATA have;
input group id sex ;
format sex gender.;
datalines;
1 133 1
3 134 1
;
run;

proc report data=have nowd;
define group/display;
run;

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!

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