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


Please Help Members By Posting Answers For Below Questions

How would you invoke a macro? : sas-macro

548


Give e an example of..

1841


what is information maps?

1612


How does proc sql work?

611


Describe the ways in which you can create macro variables?

631






What are common programming errors committed in sas

667


What is the basic structure of the SAS base program?

684


Name any two sas spawners? : sas-grid-administration

556


how does sas handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, procs? : Sas programming

596


how to debug and test the sas program? : Sas-administrator

569


What do you know about symput and symget?

727


This entry was posted in General. Bookmark the permalink. Post a comment or leave

4023


What is substr function?

622


what is a method for assigning first.var and last.var to the by groupvariable on unsorted data? : Sas programming

570


what is the limit of the number of the rows and columns available in the worksheet? : Sas-bi

631