DATA Step, Macro, Functions and more

diff b/n value and invalue in Proc Format

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 97
Accepted Solution

diff b/n value and invalue in Proc Format

hi,

I am sorry that , asking very basice questions in SAS.

what is the difference b/n the VALUE and INVALUE  statments in Proc format..

proc format;

value  $convert

'A+' = 100

'A' = 96

'A-' = 92

'B+' = 88

'B' = 84

'B-' = 80

'C+' = 76

'C' = 72

'F' = 65;

run;

data grades;

input @1 ID $3.  @4 Grade .;

format grade $convert;

datalines;

001A-

002B+

003F

004C+

005A

;

run;


Accepted Solutions
Solution
‎02-12-2013 06:13 AM
Frequent Contributor
Posts: 97

Re: diff b/n value and invalue in Proc Format

Thanks Jagadish...

View solution in original post


All Replies
Super Contributor
Posts: 276

Re: diff b/n value and invalue in Proc Format

Hi...

Value Creates Format, Invalue Creates an informat for reading and converting raw data values.

Thanks&Regards.

Sanjeev.K

Frequent Contributor
Posts: 97

Re: diff b/n value and invalue in Proc Format

thanks sanjeev ....for Breif answer..

Trusted Advisor
Posts: 1,131

Re: diff b/n value and invalue in Proc Format

Hi Allu,

No questions is less improtant, all the questions are equally important. Feel free to as any kind of question on SAS. There are many good members in this group who will provide there valuable suggestions to you.

With regard to your question,

value statement is used to create the formats to convert the numeric to character and character to character.

An informat is created to read and convert the data values using the invalue statement. it is mainly used to read the character data and convert to numeric.

In the above case invalue will work better.

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 @1 ID $3.  @4 Grade $;

/*format grade convert.;*/

new_grade=input(Grade,convert.); *To create the numeric value;

datalines;

001A-

002B+

003F

004C+

005A

;

run;

Thanks,

Jagadish

Thanks,
Jag
Solution
‎02-12-2013 06:13 AM
Frequent Contributor
Posts: 97

Re: diff b/n value and invalue in Proc Format

Thanks Jagadish...

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 178 views
  • 3 likes
  • 3 in conversation