Help using Base SAS procedures

How to ignore blank fields in table?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

How to ignore blank fields in table?

Hello all,

Just wondering if there is a command that will make SAS ignore any blank fields in a table I imported from Excel? For example, when I run a Proc Freq, I don't want SAS to count or analzye any blank fields at all, any way I can do this? I'm a SAS newbie.

Thanks


Accepted Solutions
Solution
‎10-31-2013 08:51 AM
Super Contributor
Posts: 282

Re: How to ignore blank fields in table?

Hi,

If you want to keep your original data unchanged then as said you could use a where clause in your proc freq statement so that the blank fields are not considered at all for analysis, e.g.:

proc freq data=have(where=(var1 ne ''));

The following proc freq details might also be of help with respect to missing values:

Base SAS(R) 9.2 Procedures Guide: Statistical Procedures, Third Edition

Regards,

Amir.

View solution in original post


All Replies
Respected Advisor
Posts: 3,799

Re: How to ignore blank fields in table?

Are you referring to variables with missing values for all observations?

Occasional Contributor
Posts: 8

Re: How to ignore blank fields in table?

Posted in reply to data_null__

For each column (variable) there are blanks fields, but which ones are blank vary from variable to variable. I want to tell sas to ignore the blanks when I'm analyzing a variable. Don't count them, don't do anything. Is there a way to do that?

Solution
‎10-31-2013 08:51 AM
Super Contributor
Posts: 282

Re: How to ignore blank fields in table?

Hi,

If you want to keep your original data unchanged then as said you could use a where clause in your proc freq statement so that the blank fields are not considered at all for analysis, e.g.:

proc freq data=have(where=(var1 ne ''));

The following proc freq details might also be of help with respect to missing values:

Base SAS(R) 9.2 Procedures Guide: Statistical Procedures, Third Edition

Regards,

Amir.

New Contributor Zin
New Contributor
Posts: 3

Re: How to ignore blank fields in table?

Easiest option(s) would be to remove the observations:

A)  from the dataset before running your proc freq.

B) using a where filter in your proc freq.

Super User
Super User
Posts: 7,079

Re: How to ignore blank fields in table?

Answer depends on what you mean.

If you are talking about empty cells in an Excel spreadsheet then those will normally have been converted to missing values in the SAS dataset. Almost all analysis in SAS will treat missing values properly.  So if you have three variables (columns in Excel) and each one has a different number of non-missing values when you run PROC MEANS it will use the proper N to calculate the mean.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 1489 views
  • 0 likes
  • 5 in conversation