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

Mention sas system options to debug sas macros.

659


Which date function advances a date, time or datetime value by a given interval?

662


How do you use the do loop if you don’t know how many times you should execute the do loop?

751


how do you test for missing values? : Sas programming

577


Do we follow ADAM in analysis dataset development?How? Usually which version? Why is it necessary?

1908






hi tell be about pfizer? how to compare the work with other companies ? please tell me how to login and work also?

1660


How are numeric and character missing values represented internally?

1132


What Proc glm does?

608


Explain how you can debug and test your SAS program?

564


what is the use of sas management console? : Sas-di

613


Enlist the functions performed by sas.

674


what are the categories that sas informats are used to the place the data? : Sas-administrator

611


what is sas enterprise intelligence architecture? : Sas-bi

544


How do you specify the number of iterations and specific condition within a single do loop?

617


Compare sas with other data analytics tools.

577