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.
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.