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 / ramakrishna
proc format;
invalue convert 'A+' = 100
'A' = 96
'A-' = 92
'B+' = 88
'B' = 84
'B-' = 80
'C+' = 76
'C' = 72
'F' = 65;
run;
data grades;
input ID $3. Grade $ convert.;
*format Grade convert. ;
datalines;
001 A-
002 B+
003 F
004 C+
005 A
;
proc print data = grades;
run;
Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
How would you code a macro statement to produce information on the sas log? This statement can be coded anywhere? : sas-macro
If a variable contains letters or special characters, can it be numeric data type?
describe about metadata object? : Sas-di
what do you mean by data staging area? : Sas-di
What areas of SAS are you most interested in?
Mention how to limit decimal places for the variable using proc means?
what are the component of range? : Sas-bi
data data1; input dt account; format dt date9.; cards; 1745 1230 1756 1120 1788 1130 1767 1240 ; data data2; input startdt enddt total; format startdt date9. enddt date9.; cards; 1657 1834 12300 1557 1758 16800 1789 1789 12300 1788 1345 12383 1899 1899 13250 ; proc sql; create table data3 as select * from data1 as x left join data2 as y on x.dt>=y.startdt and x.dt<=y.enddt; quit; Here, we are getting cartision product. But,I want left join report consisting of this program. It should not get duplicate values. you can modify the program also.
How will you generate test data with no input data?
is data integration and etl programming is same? : Sas-di
What is the use of stop statement?
what is the difference between calculating the 'mean' using the mean function and proc means? : Sas programming
Have you used macros? For what purpose you have used? : sas-macro
What does the trace option do?
what is the use of sas management console? : Sas-di