BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
allurai0412
Fluorite | Level 6

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;

1 ACCEPTED SOLUTION

Accepted Solutions
4 REPLIES 4
kuridisanjeev
Quartz | Level 8

Hi...

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

Thanks&Regards.

Sanjeev.K

allurai0412
Fluorite | Level 6

thanks sanjeev ....for Breif answer..

Jagadishkatam
Amethyst | Level 16

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
allurai0412
Fluorite | Level 6

Thanks Jagadish...

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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