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.
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.
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.
Awesome, how do you tell SAS to change a certain variable from character to numeric?
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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.