Hello everyone,
I am trying to create formats using proc format but for whatever reason the missing values are not getting formatted.
Same problem for both numeric and character vars.
Any idea why?
PROC FORMAT;
VALUE AREA (NOTSORTED)
1="URBAN: built-up area with a high population density"
2="RESIDENTIAL: living dwellings"
.="MISSING/UNKNOWN"
other="some other value";
RUN;
Could be that your missing values are not . but rather some other missing such as .Z or ._
PROC FORMAT;
VALUE AREA (NOTSORTED)
1="URBAN: built-up area with a high population density"
2="RESIDENTIAL: living dwellings"
.="MISSING/UNKNOWN";
RUN;
data X;
set Y;
FORMAT
AREA AREA.;
RUN;
and please note, the other values get formatted, but not the missing ones.
PROC FORMAT;
VALUE AREA (NOTSORTED)
1="URBAN: built-up area with a high population density"
2="RESIDENTIAL: living dwellings"
.="MISSING/UNKNOWN"
other="some other value";
RUN;
Could be that your missing values are not . but rather some other missing such as .Z or ._
Sadly, that is not the case. Any other possible explanation.
data have;
input area;
datalines;
1
2
.
.
;
run;
proc format;
value area
1='URBAN: built-up area with a high population density'
2='RESIDENTIAL: living dwellings'
.='MISSING/UNKNOWN';
run;
data want;
set have;
format area area.;
run;
proc print noobs;
run;
This works just fine. Can't really know for sure what's going on without data/images/etc.
Best,
I have posted the syntax in response to someone else's comment. I will not be posting the data.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.