BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jeremy4
Quartz | Level 8

Hi,

 

I have the following code below but is there a line that I could include so that I would be able to get the mean of all of the records for the 'PROV' variable, excluding all of the missing values for that variable when calculating the mean? Would this be possible without deleting the record at the start as I would like to preserve all of the data in the dataset? Thanks.

 

data April_analysis;
      set card_v_2019;
run;

 

proc means data=April_analysis mean SUM MAXDEC=2 ;
     var PROV;
     output out=PROVISION_BALANCE_MEAN;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

SAS dpes that automatically.  If you were to ask for a few more statistics on the PROC MEANS line, you might be able to see that more clearly:

 

proc means data=April_analysis mean SUM N NMISS MAXDEC=2 ;

View solution in original post

4 REPLIES 4
Astounding
PROC Star

SAS dpes that automatically.  If you were to ask for a few more statistics on the PROC MEANS line, you might be able to see that more clearly:

 

proc means data=April_analysis mean SUM N NMISS MAXDEC=2 ;
noling
SAS Employee

Ex these give the same result:

 

data temp;
	value = 1;
	output;
	value =2;
	output;
run;
proc means data=temp mean;
	var value;
run;
data temp2;
	value = 1;
	output;
	value =2;
	output;
	value=.;
	output;
run;
proc means data=temp2 mean;
	var value;
run;

Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

@noling you are doing mean on the same temp dataset 

try this

data temp;
	value = 1;
	output;
	value =2;
	output;
run;
proc means data=temp mean;
	var value;
run;
data temp2;
	value = 1;
	output;
	
	value =4;
	output;
	value=.;
	output;
run;
proc means data=temp2 mean;
	var value;
run;
noling
SAS Employee

Thanks for catching my typo 🙂 Same result, but I edited my comment.


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 7547 views
  • 2 likes
  • 4 in conversation