BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
K_S
Obsidian | Level 7 K_S
Obsidian | Level 7

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?

1 ACCEPTED SOLUTION

Accepted Solutions
unison
Lapis Lazuli | Level 10
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 ._

-unison

View solution in original post

10 REPLIES 10
PaigeMiller
Diamond | Level 26
Show us the code. Show us a portion of the data.
--
Paige Miller
K_S
Obsidian | Level 7 K_S
Obsidian | Level 7

PROC FORMAT;
VALUE AREA (NOTSORTED)
1="URBAN: built-up area with a high population density"
2="RESIDENTIAL: living dwellings"
.="MISSING/UNKNOWN";
RUN;

 

 

PaigeMiller
Diamond | Level 26
Hi. I requested you show us two things. You only showed us one.

Also show us the rest of the code where you assign the format to a variable.
--
Paige Miller
K_S
Obsidian | Level 7 K_S
Obsidian | Level 7

data X;
set Y;
FORMAT
AREA AREA.;
RUN;

 

and please note, the other values get formatted, but not the missing ones.

unison
Lapis Lazuli | Level 10
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 ._

-unison
K_S
Obsidian | Level 7 K_S
Obsidian | Level 7

Sadly, that is not the case. Any other possible explanation.

unison
Lapis Lazuli | Level 10

 

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,

 

 

-unison
K_S
Obsidian | Level 7 K_S
Obsidian | Level 7
I see what you mean now! How would i be able to find out what the missing value is? I am looking at my table and see dots.
jimbarbour
Meteorite | Level 14
Can you post your proc format code, your data, and your results? Otherwise I think I'd kind of be taking a shot in the dark.

Jim
K_S
Obsidian | Level 7 K_S
Obsidian | Level 7

I have posted the syntax in response to someone else's comment. I will not be posting the data.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 10 replies
  • 1192 views
  • 0 likes
  • 4 in conversation