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 do you code to create a macro? : sas-macro
What is the basic syntax style in SAS?
List out some key concept of SAS
What is the difference between SAS functions and procedures?
what are input dataset and output dataset options? : Sas programming
explain the use of % includes a statement in sas? : Sas-administrator
Why double trailing @@ is used in input statement?
What was the last computer book you purchased? Why?
What is the difference between reading data from an external file and reading data from an existing data set?
What is the function of Stop statement in a SAS Program?
How would you define the end of a macro?
What is a method to debug and test your SAS program?
Mention what is SAS data set?
what is the limit of the number of the rows and columns available in the worksheet? : Sas-bi
What is PROC in SAS?