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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 618 views
  • 0 likes
  • 4 in conversation