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 basic structure of a sas program?
What is the general format of function in sas? : sas-grid-administration
if you were told to create many records from one record, show how you would do this using array and with proc transpose? : Sas programming
Describe the ways in which you can create macro variables? : sas-macro
How would you code a merge that will write the matches of both to one data set, the non-matches from the left-most data?
How to limit decimal places for variable using proc means?
What is a method to debug and test your SAS program?
What function CATX syntax does?
Mention what is SAS data set?
how do you pull data from equifax?tell me the process?
Assuming {et} is randomly drawn from N(0,1) and e0 = 0, generate 200 observations of xt = et − 0.5e(t−1) and draw a line graph of xt.
what are some differences between proc summary and proc means? : Sas programming
I have a dataset concat having a variable a b & c. How to rename a b to e & f?
what are the best practices to process the large data sets in sas programming? : Sas-administrator
Explain what is SAS informats?