libname deepak 'C:\SAS Files';
proc format;
invalue convert 'A+' = 100
'A' = 96
'A-' = 92
'B+' = 88
'B' = 84
'B-' = 80
'C+' = 76
'C' = 72
'F' = 65;
data deepak.grades;
input ID $3. Grade convert.;
*format Grade convert. ;
datalines;
001 A-
002 B+
003 F
004 C+
005 A
;
proc print data = deepak.grades;
run;
I get the following output
Obs ID Grade
1 001 .
2 002 .
3 003 .
4 004 .
5 005 .
I don’t understand why Grade shows up as a missing value.
Everything seems fine, including ID $3.
Now, in case I use ID : $3. Or use column input, I get the
desired output.
Kindly help
Deepak
Answer Posted / virat samratt
proc format;
invalue $convert 'A+' = 100
'A' = 96
'A-' = 92
'B+' = 88
'B' = 84
'B-' = 80
'C+' = 76
'C' = 72
'F' = 65;
data grades;
input ID $3. Grade$ convert.;
datalines;
001 A-
002 B+
003 F
004 C+
005 A
;
add $ before format name in proc format statement
then you will get
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How would you invoke a macro? : sas-macro
Give e an example of..
what is information maps?
How does proc sql work?
Describe the ways in which you can create macro variables?
What are common programming errors committed in sas
What is the basic structure of the SAS base program?
Name any two sas spawners? : sas-grid-administration
how does sas handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, procs? : Sas programming
how to debug and test the sas program? : Sas-administrator
What do you know about symput and symget?
This entry was posted in General. Bookmark the permalink. Post a comment or leave
What is substr function?
what is a method for assigning first.var and last.var to the by groupvariable on unsorted data? : Sas programming
what is the limit of the number of the rows and columns available in the worksheet? : Sas-bi