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.

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!

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.

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
  • 5 replies
  • 5760 views
  • 0 likes
  • 5 in conversation