Goodmorning everyone!
I uploaded a dataset on Sas Viya for Learners.
My problem is: the NA values are called unknown.. how can I recall them with the classic name: 'NA' so that SAS recognise and process them as NA?
Thank you so much!
Martina
I guess(!) that you actually did not upload a dataset, but a data file that was then imported into SAS and has a numeric column with 'NA' in some places. Is that correct?
not really, sorry, probably I didn't explain well myself:
In the dataset I'm working on there are, in different columns, values called 'unknown', when I perform the imputation, SAS tell me that there aren't missing values, but actually there are and they are the unknowns!
So know: how can I substitute that 'unknown' into NA's??
Thanks in advance
Martina
OK, so we need to know
Run a PROC CONTENTS on the dataset. If you find a format attached, run this:
data _null_;
set dataset (obs=10);
format var; /* removes any format */
put var;
run;
(replace "dataset" and "var" with your dataset and variable name, respectively)
This will write the first 10 values to the SAS log, from where you can copy/paste them here.
NAs are a concept in R/Python.
Nulls/Missing are a DB concept
SAS uses spaces/blanks for character missing and . (period) for numeric missing.
Is this a correct interpretation of your question:
If this is correct, you first need to recode the unknown to missing
data missing;
set have;
if varInterest='unknown' then call missing(varInterest);
run;
@smartis wrote:
not really, sorry, probably I didn't explain well myself:
In the dataset I'm working on there are, in different columns, values called 'unknown', when I perform the imputation, SAS tell me that there aren't missing values, but actually there are and they are the unknowns!
So know: how can I substitute that 'unknown' into NA's??
Thanks in advance
Martina
Thank you so much and sorry for my late answer!
Martina
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Ready to level-up your skills? Choose your own adventure.