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
What is the use of %include statement?
How will you react when, while consulting a SAS documentation manual to get an answer to a problem, someone says hey, I thought you were supposed to know all that stuff already, and not have to look it up in a book?
explain the use of % includes a statement in sas? : Sas-administrator
What is the general format of function in sas? : sas-grid-administration
how many types prompting framework can be broken down to? : Sas-bi
What are the statements in proc sql?
What is by-group processing?
Describe the function and untility of the most difficult SAS macro that you have written.
what is sas business intelligence? : Sas-bi
Differentiate between format and informat? : sas-grid-administration
What is SAS informats?
For what purposes have you used sas macros? : sas-macro
for what purpose would you use the retain statement? : Sas programming
what is intially documentation in sas?
how the sas basic syntax style described? : Sas-administrator