DATA Step, Macro, Functions and more

SAS not interpreting blank values properly

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 9
Accepted Solution

SAS not interpreting blank values properly

Hi, I am using SAS online for academics.

 

I am having trouble with proper interpretation of data when importing an excel file. When importing the file SAS will interpret some of the blank cells correctly as a missing value represented by a ".", but for others it will not interpret them as a missing value and will represent them with a blank space. 

 

I can't really work out the difference between the ones it is interpreting as a blank and the ones it is interpreting as a "." in the excel spreadsheet.

 

Thanks. 


Accepted Solutions
Solution
‎02-04-2016 07:33 PM
Super User
Posts: 19,787

Re: SAS not interpreting blank values properly

Numerics are represented with a period when missing.

Characters are represented by a space when missing.

 

Run a PROC CONTENTS on the data set and that should align with what you're seeing.

View solution in original post


All Replies
Solution
‎02-04-2016 07:33 PM
Super User
Posts: 19,787

Re: SAS not interpreting blank values properly

Numerics are represented with a period when missing.

Characters are represented by a space when missing.

 

Run a PROC CONTENTS on the data set and that should align with what you're seeing.

Occasional Contributor
Posts: 9

Re: SAS not interpreting blank values properly

Awesome, how do you tell SAS to change a certain variable from character to numeric? 

Super User
Posts: 19,787

Re: SAS not interpreting blank values properly

Ideally you change it in the import step. Sadly that's very difficult to do when reading from an Excel file. 

 

You our can use the PUT function to create new variables that are the type you need. SAS variable types can't be changed once assigned, so you create new variables instead. If you absolutely require the original variable names you can rename the variables in the next step or in a prior step. 

☑ This topic is solved.

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

Discussion stats
  • 3 replies
  • 237 views
  • 0 likes
  • 2 in conversation