BookmarkSubscribeRSS Feed
librasantosh
Obsidian | Level 7

There is dataset with 4 variable  ID,Height Weight , Age. This dataset contain 100 enteries. In this data set there are missing value. I want to explore and clean dataset. I did proc means that gives me n, mean, std,min, max. But I want table which show me n, mean, std,min, max, nmiss, number of missing values, percentage of missing value, number of dropped variable. How can I write macro for this also.

3 REPLIES 3
Reeza
Super User

It’s not clear what you’re asking for here. 

To write a macro you should start with working base code, please include what you have so far and explain how/why you need a macro so we can make the appropriate recommendations. 

 


@librasantosh wrote:

There is dataset with 4 variable  ID,Height Weight , Age. This dataset contain 100 enteries. In this data set there are missing value. I want to explore and clean dataset. I did proc means that gives me n, mean, std,min, max. But I want table which show me n, mean, std,min, max, nmiss, number of missing values, percentage of missing value, number of dropped variable. How can I write macro for this also.


 

ballardw
Super User

what is the difference between nmiss, "number of missing values" and "dropped variable"?

 

NMISS is the number of records with missing values.

 

proc summary data=have;
   var _numeric_;
   output out=havesum n= mean= std= min= max= nmiss= /autoname;
run;

Will create a data set summarizing all of the numeric variables (or list yours of interest) and creates summary statistics with the statistic name added to the variable name to create unique names. There will also be an automatic variable named _freq_ that has the record count.

 

 

Percentages could be calculated in a data step diving any of the count values (n or nmiss) by dividing by _freq_;

 

There is likely no need for a macro at all.

Kurt_Bremser
Super User

You have been told repeatedly(!) to use more descriptive subject lines. Using just "SAS" in the main SAS forum of the world is quite lacking of intelligence.

 

Please improve on that and use the edit function to give your post a more descriptive subject line. Please.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 627 views
  • 0 likes
  • 4 in conversation