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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.