Issue
This is my proc format code:
Proc format;
value $fmtempty
" " = "unknown"
;
run;
This is my application to the data set:
DATA ASSIGN1.TRAININGCOPY;
SET TRAININGCOPY;
FORMAT job education $fmtempty.;
RUN;
At first it seemed to work but the table just comes out "goofy".
it cuts of the names of the rest of my variables, ex management becomes managem
when I run this code:
proc freq data= ASSIGN1.TRAINING; tables job; run;
for job, my frequency empty goes from 4 to 42. oddly, when I visually inspect and filter the data, the missing data has been filled in as expected, and I can't find any missing data. I have similar results with education.
original converts to
1 blue-collar 1 bluec
2 2 unknown
3 management 3 managem
4 student 4 stude
5 technician 5 techni
6 blue-collar 6 bluec
Any suggestions of what I'm doing wrong or even an explanation of what's actually happening would be greatly appreciated. Thank you in advance.
Solution
Change the Proc FORMAT
value
statement to use the (default=N)
option. N defines how much width to allocate for the format when no width is specified in a FORMAT
statement.
Example:
data have;
input text $char20.;
datalines;
blue-collar
management
student
technician
blue-collar
;
proc format;
value $fmtempty (default=20)
" " = "unknown"
;
run;
data want;
set have;
format text $fmtempty.;
run;
Answered By - Richard Answer Checked By - Gilberto Lyons (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.