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
Mention sas system options to debug sas macros.
Which date function advances a date, time or datetime value by a given interval?
How do you use the do loop if you don’t know how many times you should execute the do loop?
how do you test for missing values? : Sas programming
Do we follow ADAM in analysis dataset development?How? Usually which version? Why is it necessary?
hi tell be about pfizer? how to compare the work with other companies ? please tell me how to login and work also?
How are numeric and character missing values represented internally?
What Proc glm does?
Explain how you can debug and test your SAS program?
what is the use of sas management console? : Sas-di
Enlist the functions performed by sas.
what are the categories that sas informats are used to the place the data? : Sas-administrator
what is sas enterprise intelligence architecture? : Sas-bi
How do you specify the number of iterations and specific condition within a single do loop?
Compare sas with other data analytics tools.