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

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

1 ACCEPTED SOLUTION

Accepted Solutions
Amir
PROC Star

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

5 REPLIES 5
data_null__
Jade | Level 19

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

nikknock
Calcite | Level 5

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?

Amir
PROC Star

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.

Zin
Fluorite | Level 6 Zin
Fluorite | Level 6

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.

Tom
Super User Tom
Super User

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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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